Skip to content

PythonQt.QtNetwork.QAbstractSocket · declarations 003

Back to PythonQt.QtNetwork.QAbstractSocket

flush

flush() -> bool

X.flush() -> bool

Supplemental documentation: Qt 5 reference:

bool QAbstractSocket::flush()

This function writes as much as possible from the internal write buffer to the underlying network socket, without blocking. If any data was written, this function returns true; otherwise false is returned.

Call this function if you need QAbstractSocket to start sending buffered data immediately. The number of bytes successfully written depends on the operating system. In most cases, you do not need to call this function, because QAbstractSocket will start sending data automatically once control goes back to the event loop. In the absence of an event loop, call waitForBytesWritten() instead.

See also write() and waitForBytesWritten().

Upstream PySide2 reference signatures (binding differences may apply):

flush(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#flush

hostFound

hostFound(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QAbstractSocket.hostFound; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractSocket::hostFound()

This signal is emitted after connectToHost() has been called and the host lookup has succeeded.

Note: Since Qt 4.6.3 QAbstractSocket may emit hostFound() directly from the connectToHost() call since a DNS result could have been cached.

See also connected().

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#hostFound

isSequential

isSequential() -> bool

X.isSequential() -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QAbstractSocket::isSequential() const

Reimplements: QIODevice::isSequential() const.

Upstream PySide2 reference signatures (binding differences may apply):

isSequential(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#isSequential

isValid

isValid() -> bool

X.isValid() -> bool

Supplemental documentation: Qt 5 reference:

bool QAbstractSocket::isValid() const

Returns true if the socket is valid and ready for use; otherwise returns false.

Note: The socket's state must be ConnectedState before reading and writing can occur.

See also state().

Upstream PySide2 reference signatures (binding differences may apply):

isValid(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#isValid

localAddress

localAddress() -> Any

X.localAddress() -> PythonQt.QtNetwork.QHostAddress

Supplemental documentation: Qt 5 reference:

QHostAddress QAbstractSocket::localAddress() const

Returns the host address of the local socket if available; otherwise returns QHostAddress::Null.

This is normally the main IP address of the host, but can be QHostAddress::LocalHost (127.0.0.1) for connections to the local host.

See also localPort(), peerAddress(), and setLocalAddress().

Upstream PySide2 reference signatures (binding differences may apply):

localAddress(self) -> PySide2.QtNetwork.QHostAddress

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#localAddress

localPort

localPort() -> int

X.localPort() -> int

Supplemental documentation: Qt 5 reference:

quint16 QAbstractSocket::localPort() const

Returns the host port number (in native byte order) of the local socket if available; otherwise returns 0.

See also localAddress(), peerPort(), and setLocalPort().

Upstream PySide2 reference signatures (binding differences may apply):

localPort(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#localPort

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QAbstractSocket.objectNameChanged; argument details are not documented.

pauseMode

pauseMode() -> Any

X.pauseMode()

Supplemental documentation: Qt 5 reference:

QAbstractSocket::PauseModes QAbstractSocket::pauseMode() const

Returns the pause mode of this socket.

This function was introduced in Qt 5.0.

See also setPauseMode() and resume().

Upstream PySide2 reference signatures (binding differences may apply):

pauseMode(self) -> PySide2.QtNetwork.QAbstractSocket.PauseModes

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#pauseMode

peerAddress

peerAddress() -> Any

X.peerAddress() -> PythonQt.QtNetwork.QHostAddress

Supplemental documentation: Qt 5 reference:

QHostAddress QAbstractSocket::peerAddress() const

Returns the address of the connected peer if the socket is in ConnectedState; otherwise returns QHostAddress::Null.

See also peerName(), peerPort(), localAddress(), and setPeerAddress().

Upstream PySide2 reference signatures (binding differences may apply):

peerAddress(self) -> PySide2.QtNetwork.QHostAddress

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#peerAddress

peerName

peerName() -> str

X.peerName() -> str

Supplemental documentation: Qt 5 reference:

QString QAbstractSocket::peerName() const

Returns the name of the peer as specified by connectToHost(), or an empty QString if connectToHost() has not been called.

See also peerAddress(), peerPort(), and setPeerName().

Upstream PySide2 reference signatures (binding differences may apply):

peerName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#peerName

peerPort

peerPort() -> int

X.peerPort() -> int

Supplemental documentation: Qt 5 reference:

quint16 QAbstractSocket::peerPort() const

Returns the port of the connected peer if the socket is in ConnectedState; otherwise returns 0.

See also peerAddress(), localPort(), and setPeerPort().

Upstream PySide2 reference signatures (binding differences may apply):

peerPort(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#peerPort

proxy

proxy() -> Any

X.proxy() -> PythonQt.QtNetwork.QNetworkProxy

Supplemental documentation: Qt 5 reference:

QNetworkProxy QAbstractSocket::proxy() const

Returns the network proxy for this socket. By default QNetworkProxy::DefaultProxy is used, which means this socket will query the default proxy settings for the application.

This function was introduced in Qt 4.1.

See also setProxy(), QNetworkProxy, and QNetworkProxyFactory.

Upstream PySide2 reference signatures (binding differences may apply):

proxy(self) -> PySide2.QtNetwork.QNetworkProxy

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#proxy

proxyAuthenticationRequired

proxyAuthenticationRequired(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QAbstractSocket.proxyAuthenticationRequired; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractSocket::proxyAuthenticationRequired(const QNetworkProxy \&proxy, QAuthenticator *authenticator)

This signal can be emitted when a proxy that requires authentication is used. The authenticator object can then be filled in with the required details to allow authentication and continue the connection.

Note: It is not possible to use a QueuedConnection to connect to this signal, as the connection will fail if the authenticator has not been filled in with new information when the signal returns.

This function was introduced in Qt 4.3.

See also QAuthenticator and QNetworkProxy.

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#proxyAuthenticationRequired

readBufferSize

readBufferSize() -> int

X.readBufferSize() -> int

Supplemental documentation: Qt 5 reference:

qint64 QAbstractSocket::readBufferSize() const

Returns the size of the internal read buffer. This limits the amount of data that the client can receive before you call read() or readAll().

A read buffer size of 0 (the default) means that the buffer has no size limit, ensuring that no data is lost.

See also setReadBufferSize() and read().

Upstream PySide2 reference signatures (binding differences may apply):

readBufferSize(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#readBufferSize

readChannelFinished

readChannelFinished(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QAbstractSocket.readChannelFinished; argument details are not documented.

readData

readData(data: str, maxlen: int) -> int

X.readData(data, maxlen) -> int

Supplemental documentation: Qt 5 reference:

[override virtual protected] qint64 QAbstractSocket::readData(char *data, qint64 maxSize)

Reimplements: QIODevice::readData(char *data, qint64 maxSize).

Upstream PySide2 reference signatures (binding differences may apply):

readData(self, data: str, maxlen: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#readData

readLineData

readLineData(data: str, maxlen: int) -> int

X.readLineData(data, maxlen) -> int

Supplemental documentation: Qt 5 reference:

[override virtual protected] qint64 QAbstractSocket::readLineData(char *data, qint64 maxlen)

Reimplements: QIODevice::readLineData(char *data, qint64 maxSize).

Upstream PySide2 reference signatures (binding differences may apply):

readLineData(self, data: str, maxlen: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#readLineData

readyRead

readyRead(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QAbstractSocket.readyRead; argument details are not documented.

resume

resume() -> None

X.resume()

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractSocket::resume()

Continues data transfer on the socket. This method should only be used after the socket has been set to pause upon notifications and a notification has been received. The only notification currently supported is QSslSocket::sslErrors(). Calling this method if the socket is not paused results in undefined behavior.

This function was introduced in Qt 5.0.

See also pauseMode() and setPauseMode().

Upstream PySide2 reference signatures (binding differences may apply):

resume(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#resume

setLocalAddress

setLocalAddress(address: Any) -> None

X.setLocalAddress(address)

Supplemental documentation: Qt 5 reference:

[protected] void QAbstractSocket::setLocalAddress(const QHostAddress \&address)

Sets the address on the local side of a connection to address.

You can call this function in a subclass of QAbstractSocket to change the return value of the localAddress() function after a connection has been established. This feature is commonly used by proxy connections for virtual connection settings.

Note that this function does not bind the local address of the socket prior to a connection (e.g., QAbstractSocket::bind()).

This function was introduced in Qt 4.1.

See also localAddress(), setLocalPort(), and setPeerAddress().

Upstream PySide2 reference signatures (binding differences may apply):

setLocalAddress(self, address: PySide2.QtNetwork.QHostAddress) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setLocalAddress

setLocalPort

setLocalPort(port: int) -> None

X.setLocalPort(port)

Supplemental documentation: Qt 5 reference:

[protected] void QAbstractSocket::setLocalPort(quint16 port)

Sets the port on the local side of a connection to port.

You can call this function in a subclass of QAbstractSocket to change the return value of the localPort() function after a connection has been established. This feature is commonly used by proxy connections for virtual connection settings.

Note that this function does not bind the local port of the socket prior to a connection (e.g., QAbstractSocket::bind()).

This function was introduced in Qt 4.1.

See also localPort(), localAddress(), setLocalAddress(), and setPeerPort().

Upstream PySide2 reference signatures (binding differences may apply):

setLocalPort(self, port: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setLocalPort

setPauseMode

setPauseMode(pauseMode: Any) -> None

X.setPauseMode(pauseMode)

Supplemental documentation: Qt 5 reference:

void QAbstractSocket::setPauseMode(QAbstractSocket::PauseModes pauseMode)

Controls whether to pause upon receiving a notification. The pauseMode parameter specifies the conditions in which the socket should be paused. The only notification currently supported is QSslSocket::sslErrors(). If set to PauseOnSslErrors, data transfer on the socket will be paused and needs to be enabled explicitly again by calling resume(). By default this option is set to PauseNever. This option must be called before connecting to the server, otherwise it will result in undefined behavior.

This function was introduced in Qt 5.0.

See also pauseMode() and resume().

Upstream PySide2 reference signatures (binding differences may apply):

setPauseMode(self, pauseMode: PySide2.QtNetwork.QAbstractSocket.PauseModes) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setPauseMode

setPeerAddress

setPeerAddress(address: Any) -> None

X.setPeerAddress(address)

Supplemental documentation: Qt 5 reference:

[protected] void QAbstractSocket::setPeerAddress(const QHostAddress \&address)

Sets the address of the remote side of the connection to address.

You can call this function in a subclass of QAbstractSocket to change the return value of the peerAddress() function after a connection has been established. This feature is commonly used by proxy connections for virtual connection settings.

This function was introduced in Qt 4.1.

See also peerAddress(), setPeerPort(), and setLocalAddress().

Upstream PySide2 reference signatures (binding differences may apply):

setPeerAddress(self, address: PySide2.QtNetwork.QHostAddress) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setPeerAddress

setPeerName

setPeerName(name: str) -> None

X.setPeerName(name)

Supplemental documentation: Qt 5 reference:

[protected] void QAbstractSocket::setPeerName(const QString \&name)

Sets the host name of the remote peer to name.

You can call this function in a subclass of QAbstractSocket to change the return value of the peerName() function after a connection has been established. This feature is commonly used by proxy connections for virtual connection settings.

This function was introduced in Qt 4.1.

See also peerName().

Upstream PySide2 reference signatures (binding differences may apply):

setPeerName(self, name: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setPeerName

setPeerPort

setPeerPort(port: int) -> None

X.setPeerPort(port)

Supplemental documentation: Qt 5 reference:

[protected] void QAbstractSocket::setPeerPort(quint16 port)

Sets the port of the remote side of the connection to port.

You can call this function in a subclass of QAbstractSocket to change the return value of the peerPort() function after a connection has been established. This feature is commonly used by proxy connections for virtual connection settings.

This function was introduced in Qt 4.1.

See also peerPort(), setPeerAddress(), and setLocalPort().

Upstream PySide2 reference signatures (binding differences may apply):

setPeerPort(self, port: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setPeerPort

setProxy

setProxy(networkProxy: Any) -> None

X.setProxy(networkProxy)

Supplemental documentation: Qt 5 reference:

void QAbstractSocket::setProxy(const QNetworkProxy \&networkProxy)

Sets the explicit network proxy for this socket to networkProxy.

To disable the use of a proxy for this socket, use the QNetworkProxy::NoProxy proxy type:

socket->setProxy(QNetworkProxy::NoProxy);

The default value for the proxy is QNetworkProxy::DefaultProxy, which means the socket will use the application settings: if a proxy is set with QNetworkProxy::setApplicationProxy, it will use that; otherwise, if a factory is set with QNetworkProxyFactory::setApplicationProxyFactory, it will query that factory with type QNetworkProxyQuery::TcpSocket.

This function was introduced in Qt 4.1.

See also proxy(), QNetworkProxy, and QNetworkProxyFactory::queryProxy().

Upstream PySide2 reference signatures (binding differences may apply):

setProxy(self, networkProxy: PySide2.QtNetwork.QNetworkProxy) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setProxy

setReadBufferSize

setReadBufferSize(size: int) -> None

X.setReadBufferSize(size)

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractSocket::setReadBufferSize(qint64 size)

Sets the size of QAbstractSocket's internal read buffer to be size bytes.

If the buffer size is limited to a certain size, QAbstractSocket won't buffer more than this size of data. Exceptionally, a buffer size of 0 means that the read buffer is unlimited and all incoming data is buffered. This is the default.

This option is useful if you only read the data at certain points in time (e.g., in a real-time streaming application) or if you want to protect your socket against receiving too much data, which may eventually cause your application to run out of memory.

Only QTcpSocket uses QAbstractSocket's internal buffer; QUdpSocket does not use any buffering at all, but rather relies on the implicit buffering provided by the operating system. Because of this, calling this function on QUdpSocket has no effect.

See also readBufferSize() and read().

Upstream PySide2 reference signatures (binding differences may apply):

setReadBufferSize(self, size: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setReadBufferSize

setSocketDescriptor

setSocketDescriptor(socketDescriptor: int, state: Any, openMode: Any) -> bool

X.setSocketDescriptor(socketDescriptor, state, openMode) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, QAbstractSocket::SocketState socketState \= ConnectedState, QIODevice::OpenMode openMode \= ReadWrite)

Initializes QAbstractSocket with the native socket descriptor socketDescriptor. Returns true if socketDescriptor is accepted as a valid socket descriptor; otherwise returns false. The socket is opened in the mode specified by openMode, and enters the socket state specified by socketState. Read and write buffers are cleared, discarding any pending data.

Note: It is not possible to initialize two abstract sockets with the same native socket descriptor.

See also socketDescriptor().

Upstream PySide2 reference signatures (binding differences may apply):

setSocketDescriptor(self, socketDescriptor: int, state: PySide2.QtNetwork.QAbstractSocket.SocketState=..., openMode: PySide2.QtCore.QIODevice.OpenMode=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setSocketDescriptor

setSocketError

setSocketError(socketError: Any) -> None

X.setSocketError(socketError)

Supplemental documentation: Qt 5 reference:

[protected] void QAbstractSocket::setSocketError(QAbstractSocket::SocketError socketError)

Sets the type of error that last occurred to socketError.

See also setSocketState() and setErrorString().

Upstream PySide2 reference signatures (binding differences may apply):

setSocketError(self, socketError: PySide2.QtNetwork.QAbstractSocket.SocketError) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setSocketError

setSocketOption

setSocketOption(option: Any, value: Any) -> None

X.setSocketOption(option, value)

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant \&value)

Sets the given option to the value described by value.

Note: On Windows Runtime, QAbstractSocket::KeepAliveOption must be set before the socket is connected.

This function was introduced in Qt 4.6.

See also socketOption().

Upstream PySide2 reference signatures (binding differences may apply):

setSocketOption(self, option: PySide2.QtNetwork.QAbstractSocket.SocketOption, value: typing.Any) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setSocketOption

setSocketState

setSocketState(state: Any) -> None

X.setSocketState(state)

Supplemental documentation: Qt 5 reference:

[protected] void QAbstractSocket::setSocketState(QAbstractSocket::SocketState state)

Sets the state of the socket to state.

See also state().

Upstream PySide2 reference signatures (binding differences may apply):

setSocketState(self, state: PySide2.QtNetwork.QAbstractSocket.SocketState) -> None

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#setSocketState

socketDescriptor

socketDescriptor() -> int

X.socketDescriptor() -> int

Supplemental documentation: Qt 5 reference:

[virtual] qintptr QAbstractSocket::socketDescriptor() const

Returns the native socket descriptor of the QAbstractSocket object if this is available; otherwise returns -1.

If the socket is using QNetworkProxy, the returned descriptor may not be usable with native socket functions.

The socket descriptor is not available when QAbstractSocket is in UnconnectedState.

See also setSocketDescriptor().

Upstream PySide2 reference signatures (binding differences may apply):

socketDescriptor(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#socketDescriptor

socketOption

socketOption(option: Any) -> Any

X.socketOption(option) -> object

Supplemental documentation: Qt 5 reference:

[virtual] QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option)

Returns the value of the option option.

This function was introduced in Qt 4.6.

See also setSocketOption().

Upstream PySide2 reference signatures (binding differences may apply):

socketOption(self, option: PySide2.QtNetwork.QAbstractSocket.SocketOption) -> typing.Any

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#socketOption

socketType

socketType() -> Any

X.socketType()

Supplemental documentation: Qt 5 reference:

QAbstractSocket::SocketType QAbstractSocket::socketType() const

Returns the socket type (TCP, UDP, or other).

See also QTcpSocket and QUdpSocket.

Upstream PySide2 reference signatures (binding differences may apply):

socketType(self) -> PySide2.QtNetwork.QAbstractSocket.SocketType

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#socketType

state

state() -> Any

X.state()

Supplemental documentation: Qt 5 reference:

QAbstractSocket::SocketState QAbstractSocket::state() const

Returns the state of the socket.

See also error().

Upstream PySide2 reference signatures (binding differences may apply):

state(self) -> PySide2.QtNetwork.QAbstractSocket.SocketState

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#state

stateChanged

stateChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QAbstractSocket.stateChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractSocket::stateChanged(QAbstractSocket::SocketState socketState)

This signal is emitted whenever QAbstractSocket's state changes. The socketState parameter is the new state.

QAbstractSocket::SocketState is not a registered metatype, so for queued connections, you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType().

See also state() and Creating Custom Qt Types.

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#stateChanged

waitForBytesWritten

waitForBytesWritten(msecs: int) -> bool

X.waitForBytesWritten(msecs) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QAbstractSocket::waitForBytesWritten(int msecs \= 30000)

Reimplements: QIODevice::waitForBytesWritten(int msecs).

This function blocks until at least one byte has been written on the socket and the bytesWritten() signal has been emitted. The function will timeout after msecs milliseconds; the default timeout is 30000 milliseconds.

The function returns true if the bytesWritten() signal is emitted; otherwise it returns false (if an error occurred or the operation timed out).

Note: This function may fail randomly on Windows. Consider using the event loop and the bytesWritten() signal if your software will run on Windows.

See also waitForReadyRead().

Upstream PySide2 reference signatures (binding differences may apply):

waitForBytesWritten(self, msecs: int=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#waitForBytesWritten

waitForConnected

waitForConnected(msecs: int) -> bool

X.waitForConnected(msecs) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QAbstractSocket::waitForConnected(int msecs \= 30000)

Waits until the socket is connected, up to msecs milliseconds. If the connection has been established, this function returns true; otherwise it returns false. In the case where it returns false, you can call error() to determine the cause of the error.

The following example waits up to one second for a connection to be established:

socket->connectToHost("imap", 143);
if (socket->waitForConnected(1000))
    qDebug("Connected!");

If msecs is -1, this function will not time out.

Note: This function may wait slightly longer than msecs, depending on the time it takes to complete the host lookup.

Note: Multiple calls to this functions do not accumulate the time. If the function times out, the connecting process will be aborted.

Note: This function may fail randomly on Windows. Consider using the event loop and the connected() signal if your software will run on Windows.

See also connectToHost() and connected().

Upstream PySide2 reference signatures (binding differences may apply):

waitForConnected(self, msecs: int=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#waitForConnected

waitForDisconnected

waitForDisconnected(msecs: int) -> bool

X.waitForDisconnected(msecs) -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QAbstractSocket::waitForDisconnected(int msecs \= 30000)

Waits until the socket has disconnected, up to msecs milliseconds. If the connection was successfully disconnected, this function returns true; otherwise it returns false (if the operation timed out, if an error occurred, or if this QAbstractSocket is already disconnected). In the case where it returns false, you can call error() to determine the cause of the error.

The following example waits up to one second for a connection to be closed:

socket->disconnectFromHost();
if (socket->state() == QAbstractSocket::UnconnectedState
    || socket->waitForDisconnected(1000)) {
        qDebug("Disconnected!");
}

If msecs is -1, this function will not time out.

Note: This function may fail randomly on Windows. Consider using the event loop and the disconnected() signal if your software will run on Windows.

See also disconnectFromHost() and close().

Upstream PySide2 reference signatures (binding differences may apply):

waitForDisconnected(self, msecs: int=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#waitForDisconnected

waitForReadyRead

waitForReadyRead(msecs: int) -> bool

X.waitForReadyRead(msecs) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QAbstractSocket::waitForReadyRead(int msecs \= 30000)

Reimplements: QIODevice::waitForReadyRead(int msecs).

This function blocks until new data is available for reading and the readyRead() signal has been emitted. The function will timeout after msecs milliseconds; the default timeout is 30000 milliseconds.

The function returns true if the readyRead() signal is emitted and there is new data available for reading; otherwise it returns false (if an error occurred or the operation timed out).

Note: This function may fail randomly on Windows. Consider using the event loop and the readyRead() signal if your software will run on Windows.

See also waitForBytesWritten().

Upstream PySide2 reference signatures (binding differences may apply):

waitForReadyRead(self, msecs: int=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qabstractsocket.html#waitForReadyRead