Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QLocalUnixSocket Class Reference

#include <qlocalsocket_p.h>

Inheritance diagram for QLocalUnixSocket:
Collaboration diagram for QLocalUnixSocket:

Public Member Functions

 QLocalUnixSocket ()
void setSocketState (QAbstractSocket::SocketState state)
void setErrorString (const QString &string)
void setSocketError (QAbstractSocket::SocketError error)
qint64 readData (char *data, qint64 maxSize) override
qint64 writeData (const char *data, qint64 maxSize) override
Public Member Functions inherited from QTcpSocket
 QTcpSocket (QObject *parent=nullptr)
 Creates a QTcpSocket object in state UnconnectedState.
virtual ~QTcpSocket ()
 Destroys the socket, closing the connection if necessary.
Public Member Functions inherited from QAbstractSocket
 QAbstractSocket (SocketType socketType, QObject *parent)
 Creates a new abstract socket of type socketType.
virtual ~QAbstractSocket ()
 Destroys the socket.
virtual void resume ()
PauseModes pauseMode () const
void setPauseMode (PauseModes pauseMode)
virtual bool bind (const QHostAddress &address, quint16 port=0, BindMode mode=DefaultForPlatform)
bool bind (QHostAddress::SpecialAddress addr, quint16 port=0, BindMode mode=DefaultForPlatform)
bool bind (quint16 port=0, BindMode mode=DefaultForPlatform)
virtual void connectToHost (const QString &hostName, quint16 port, OpenMode mode=ReadWrite, NetworkLayerProtocol protocol=AnyIPProtocol)
 Attempts to make a connection to hostName on the given port.
void connectToHost (const QHostAddress &address, quint16 port, OpenMode mode=ReadWrite)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Attempts to make a connection to address on port port.
virtual void disconnectFromHost ()
 Attempts to close the socket.
bool isValid () const
 Returns true if the socket is valid and ready for use; otherwise returns false.
qint64 bytesAvailable () const override
 Returns the number of incoming bytes that are waiting to be read.
qint64 bytesToWrite () const override
 Returns the number of bytes that are waiting to be written.
quint16 localPort () const
 Returns the host port number (in native byte order) of the local socket if available; otherwise returns 0.
QHostAddress localAddress () const
 Returns the host address of the local socket if available; otherwise returns QHostAddress::Null.
quint16 peerPort () const
 Returns the port of the connected peer if the socket is in ConnectedState; otherwise returns 0.
QHostAddress peerAddress () const
 Returns the address of the connected peer if the socket is in ConnectedState; otherwise returns QHostAddress::Null.
QString peerName () const
 Returns the name of the peer as specified by connectToHost(), or an empty QString if connectToHost() has not been called.
qint64 readBufferSize () const
 Returns the size of the internal read buffer.
virtual void setReadBufferSize (qint64 size)
 Sets the size of QAbstractSocket's internal read buffer to be size bytes.
void abort ()
 Aborts the current connection and resets the socket.
virtual qintptr socketDescriptor () const
 Returns the native socket descriptor of the QAbstractSocket object if this is available; otherwise returns -1.
virtual bool setSocketDescriptor (qintptr socketDescriptor, SocketState state=ConnectedState, OpenMode openMode=ReadWrite)
 Initializes QAbstractSocket with the native socket descriptor socketDescriptor.
virtual void setSocketOption (QAbstractSocket::SocketOption option, const QVariant &value)
virtual QVariant socketOption (QAbstractSocket::SocketOption option)
SocketType socketType () const
 Returns the socket type (TCP, UDP, or other).
SocketState state () const
 Returns the state of the socket.
SocketError error () const
 Returns the type of error that last occurred.
void close () override
 Closes the I/O device for the socket and calls disconnectFromHost() to close the socket's connection.
bool isSequential () const override
 \reimp
bool flush ()
 This function writes as much as possible from the internal write buffer to the underlying network socket, without blocking.
virtual bool waitForConnected (int msecs=30000)
 Waits until the socket is connected, up to msecs milliseconds.
bool waitForReadyRead (int msecs=30000) override
 This function blocks until new data is available for reading and the \l{QIODevice::}{readyRead()} signal has been emitted.
bool waitForBytesWritten (int msecs=30000) override
 \reimp
virtual bool waitForDisconnected (int msecs=30000)
 Waits until the socket has disconnected, up to msecs milliseconds.
void setProxy (const QNetworkProxy &networkProxy)
QNetworkProxy proxy () const
QString protocolTag () const
void setProtocolTag (const QString &tag)

Additional Inherited Members

Public Types inherited from QAbstractSocket
enum  SocketType { TcpSocket , UdpSocket , SctpSocket , UnknownSocketType = -1 }
 This enum describes the transport layer protocol. More...
enum  SocketError {
  ConnectionRefusedError , RemoteHostClosedError , HostNotFoundError , SocketAccessError ,
  SocketResourceError , SocketTimeoutError , DatagramTooLargeError , NetworkError ,
  AddressInUseError , SocketAddressNotAvailableError , UnsupportedSocketOperationError , UnfinishedSocketOperationError ,
  ProxyAuthenticationRequiredError , SslHandshakeFailedError , ProxyConnectionRefusedError , ProxyConnectionClosedError ,
  ProxyConnectionTimeoutError , ProxyNotFoundError , ProxyProtocolError , OperationError ,
  SslInternalError , SslInvalidUserDataError , TemporaryError , UnknownSocketError = -1
}
 This enum describes the socket errors that can occur. More...
enum  SocketState {
  UnconnectedState , HostLookupState , ConnectingState , ConnectedState ,
  BoundState , ListeningState , ClosingState
}
 This enum describes the different states in which a socket can be. More...
enum  SocketOption {
  LowDelayOption , KeepAliveOption , MulticastTtlOption , MulticastLoopbackOption ,
  TypeOfServiceOption , SendBufferSizeSocketOption , ReceiveBufferSizeSocketOption , PathMtuSocketOption
}
enum  BindFlag { DefaultForPlatform = 0x0 , ShareAddress = 0x1 , DontShareAddress = 0x2 , ReuseAddressHint = 0x4 }
enum  PauseMode { PauseNever = 0x0 , PauseOnSslErrors = 0x1 }
Public Types inherited from QtPrivate::QAbstractSocketConstants
using NetworkLayerProtocol = QHostAddress::NetworkLayerProtocol
Signals inherited from QAbstractSocket
void hostFound ()
 This signal is emitted after connectToHost() has been called and the host lookup has succeeded.
void connected ()
 This signal is emitted after connectToHost() has been called and a connection has been successfully established.
void disconnected ()
 This signal is emitted when the socket has been disconnected.
void stateChanged (QAbstractSocket::SocketState)
 This signal is emitted whenever QAbstractSocket's state changes.
void errorOccurred (QAbstractSocket::SocketError)
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator)
Static Public Attributes inherited from QtPrivate::QAbstractSocketConstants
static constexpr auto IPv4Protocol = QHostAddress::IPv4Protocol
static constexpr auto IPv6Protocol = QHostAddress::IPv6Protocol
static constexpr auto AnyIPProtocol = QHostAddress::AnyIPProtocol
static constexpr auto UnknownNetworkLayerProtocol = QHostAddress::UnknownNetworkLayerProtocol
Protected Member Functions inherited from QTcpSocket
 QTcpSocket (QTcpSocketPrivate &dd, QObject *parent=nullptr)
 QTcpSocket (QAbstractSocket::SocketType socketType, QTcpSocketPrivate &dd, QObject *parent=nullptr)
Protected Member Functions inherited from QAbstractSocket
qint64 readData (char *data, qint64 maxlen) override
 \reimp
qint64 readLineData (char *data, qint64 maxlen) override
 \reimp
qint64 skipData (qint64 maxSize) override
 \reimp
qint64 writeData (const char *data, qint64 len) override
 \reimp
void setSocketState (SocketState state)
 Sets the state of the socket to state.
void setSocketError (SocketError socketError)
 Sets the type of error that last occurred to socketError.
void setLocalPort (quint16 port)
void setLocalAddress (const QHostAddress &address)
void setPeerPort (quint16 port)
void setPeerAddress (const QHostAddress &address)
void setPeerName (const QString &name)
 QAbstractSocket (SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent=nullptr)

Detailed Description

Definition at line 47 of file qlocalsocket_p.h.

Constructor & Destructor Documentation

◆ QLocalUnixSocket()

QLocalUnixSocket::QLocalUnixSocket ( )
inline

Definition at line 51 of file qlocalsocket_p.h.

Member Function Documentation

◆ readData()

qint64 QLocalUnixSocket::readData ( char * data,
qint64 maxSize )
inlineoverride

Definition at line 70 of file qlocalsocket_p.h.

◆ setErrorString()

void QLocalUnixSocket::setErrorString ( const QString & string)
inline

Definition at line 60 of file qlocalsocket_p.h.

◆ setSocketError()

void QLocalUnixSocket::setSocketError ( QAbstractSocket::SocketError error)
inline

Definition at line 65 of file qlocalsocket_p.h.

◆ setSocketState()

void QLocalUnixSocket::setSocketState ( QAbstractSocket::SocketState state)
inline

Definition at line 55 of file qlocalsocket_p.h.

◆ writeData()

qint64 QLocalUnixSocket::writeData ( const char * data,
qint64 maxSize )
inlineoverride

Definition at line 75 of file qlocalsocket_p.h.


The documentation for this class was generated from the following file: