Skip to content

PythonQt.QtNetwork.QAbstractSocket · declarations 002

Back to PythonQt.QtNetwork.QAbstractSocket

ShareAddress instance-attribute

ShareAddress: Any

SocketAccessError instance-attribute

SocketAccessError: Any

SocketAddressNotAvailableError instance-attribute

SocketAddressNotAvailableError: Any

SocketError instance-attribute

SocketError: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

SocketOption instance-attribute

SocketOption: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

SocketResourceError instance-attribute

SocketResourceError: Any

SocketState instance-attribute

SocketState: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

SocketTimeoutError instance-attribute

SocketTimeoutError: Any

SocketType instance-attribute

SocketType: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

SslHandshakeFailedError instance-attribute

SslHandshakeFailedError: Any

SslInternalError instance-attribute

SslInternalError: Any

SslInvalidUserDataError instance-attribute

SslInvalidUserDataError: Any

TcpSocket instance-attribute

TcpSocket: Any

TemporaryError instance-attribute

TemporaryError: Any

TypeOfServiceOption instance-attribute

TypeOfServiceOption: Any

UdpSocket instance-attribute

UdpSocket: Any

UnconnectedState instance-attribute

UnconnectedState: Any

UnfinishedSocketOperationError instance-attribute

UnfinishedSocketOperationError: Any

UnknownNetworkLayerProtocol instance-attribute

UnknownNetworkLayerProtocol: Any

UnknownSocketError instance-attribute

UnknownSocketError: Any

UnknownSocketType instance-attribute

UnknownSocketType: Any

UnsupportedSocketOperationError instance-attribute

UnsupportedSocketOperationError: Any

abort

abort() -> None

X.abort()

Supplemental documentation: Qt 5 reference:

void QAbstractSocket::abort()

Aborts the current connection and resets the socket. Unlike disconnectFromHost(), this function immediately closes the socket, discarding any pending data in the write buffer.

See also disconnectFromHost() and close().

Upstream PySide2 reference signatures (binding differences may apply):

abort(self) -> None

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

aboutToClose

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

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

atEnd

atEnd() -> bool

X.atEnd() -> bool

Supplemental documentation: Qt 5 reference:

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

Reimplements: QIODevice::atEnd() const.

Returns true if no more data is currently available for reading; otherwise returns false.

This function is most commonly used when reading data from the socket in a loop. For example:

 // This slot is connected to QAbstractSocket::readyRead()
 void SocketClass::readyReadSlot()
 {
     while (!socket.atEnd()) {
         QByteArray data = socket.read(100);
         ....
     }
 }

See also bytesAvailable() and readyRead().

Upstream PySide2 reference signatures (binding differences may apply):

atEnd(self) -> bool

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

bind

bind(address: Any, port: int, mode: Any) -> bool

X.bind(address, port, mode) -> bool

Supplemental documentation: Qt 5 reference:

bool QAbstractSocket::bind(const QHostAddress \&address, quint16 port \= 0, QAbstractSocket::BindMode mode \= ...)

Binds to address on port port, using the BindMode mode.

For UDP sockets, after binding, the signal QUdpSocket::readyRead() is emitted whenever a UDP datagram arrives on the specified address and port. Thus, this function is useful to write UDP servers.

For TCP sockets, this function may be used to specify which interface to use for an outgoing connection, which is useful in case of multiple network interfaces.

By default, the socket is bound using the DefaultForPlatform BindMode. If a port is not specified, a random port is chosen.

On success, the function returns true and the socket enters BoundState; otherwise it returns false.

This function was introduced in Qt 5.0.

bool QAbstractSocket::bind(quint16 port \= 0, QAbstractSocket::BindMode mode \= DefaultForPlatform)

This is an overloaded function.

Binds to QHostAddress:Any on port port, using the BindMode mode.

By default, the socket is bound using the DefaultForPlatform BindMode. If a port is not specified, a random port is chosen.

This function was introduced in Qt 5.0.

Upstream PySide2 reference signatures (binding differences may apply):

bind(self, address: PySide2.QtNetwork.QHostAddress, port: int=..., mode: PySide2.QtNetwork.QAbstractSocket.BindMode=...) -> bool
bind(self, port: int=..., mode: PySide2.QtNetwork.QAbstractSocket.BindMode=...) -> bool

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

bytesAvailable

bytesAvailable() -> int

X.bytesAvailable() -> int

Supplemental documentation: Qt 5 reference:

[override virtual] qint64 QAbstractSocket::bytesAvailable() const

Reimplements: QIODevice::bytesAvailable() const.

Returns the number of incoming bytes that are waiting to be read.

See also bytesToWrite() and read().

Upstream PySide2 reference signatures (binding differences may apply):

bytesAvailable(self) -> int

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

bytesToWrite

bytesToWrite() -> int

X.bytesToWrite() -> int

Supplemental documentation: Qt 5 reference:

[override virtual] qint64 QAbstractSocket::bytesToWrite() const

Reimplements: QIODevice::bytesToWrite() const.

Returns the number of bytes that are waiting to be written. The bytes are written when control goes back to the event loop or when flush() is called.

See also bytesAvailable() and flush().

Upstream PySide2 reference signatures (binding differences may apply):

bytesToWrite(self) -> int

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

bytesWritten

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

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

canReadLine

canReadLine() -> bool

X.canReadLine() -> bool

Supplemental documentation: Qt 5 reference:

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

Reimplements: QIODevice::canReadLine() const.

Returns true if a line of data can be read from the socket; otherwise returns false.

See also readLine().

Upstream PySide2 reference signatures (binding differences may apply):

canReadLine(self) -> bool

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

channelBytesWritten

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

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

channelReadyRead

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

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

close

close() -> None

X.close()

Supplemental documentation: Qt 5 reference:

[override virtual] void QAbstractSocket::close()

Reimplements: QIODevice::close().

Closes the I/O device for the socket and calls disconnectFromHost() to close the socket's connection.

See QIODevice::close() for a description of the actions that occur when an I/O device is closed.

See also abort().

Upstream PySide2 reference signatures (binding differences may apply):

close(self) -> None

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

connectToHost

connectToHost(hostName: Any, port: int, mode: Any, protocol: Any) -> None

X.connectToHost(hostName, port, mode, protocol)

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractSocket::connectToHost(const QString \&hostName, quint16 port, QIODevice::OpenMode openMode \= ReadWrite, QAbstractSocket::NetworkLayerProtocol protocol \= AnyIPProtocol)

Attempts to make a connection to hostName on the given port. The protocol parameter can be used to specify which network protocol to use (eg. IPv4 or IPv6).

The socket is opened in the given openMode and first enters HostLookupState, then performs a host name lookup of hostName. If the lookup succeeds, hostFound() is emitted and QAbstractSocket enters ConnectingState. It then attempts to connect to the address or addresses returned by the lookup. Finally, if a connection is established, QAbstractSocket enters ConnectedState and emits connected().

At any point, the socket can emit errorOccurred() to signal that an error occurred.

hostName may be an IP address in string form (e.g., "43.195.83.32"), or it may be a host name (e.g., "example.com"). QAbstractSocket will do a lookup only if required. port is in native byte order.

See also state(), peerName(), peerAddress(), peerPort(), and waitForConnected().

[virtual] void QAbstractSocket::connectToHost(const QHostAddress \&address, quint16 port, QIODevice::OpenMode openMode \= ReadWrite)

This is an overloaded function.

Attempts to make a connection to address on port port.

Upstream PySide2 reference signatures (binding differences may apply):

connectToHost(self, address: PySide2.QtNetwork.QHostAddress, port: int, mode: PySide2.QtCore.QIODevice.OpenMode=...) -> None
connectToHost(self, hostName: str, port: int, mode: PySide2.QtCore.QIODevice.OpenMode=..., protocol: PySide2.QtNetwork.QAbstractSocket.NetworkLayerProtocol=...) -> None

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

connected

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

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

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractSocket::connected()

This signal is emitted after connectToHost() has been called and a connection has been successfully established.

Note: On some operating systems the connected() signal may be directly emitted from the connectToHost() call for connections to the localhost.

See also connectToHost() and disconnected().

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

destroyed

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

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

disconnectFromHost

disconnectFromHost() -> None

X.disconnectFromHost()

Supplemental documentation: Qt 5 reference:

[virtual] void QAbstractSocket::disconnectFromHost()

Attempts to close the socket. If there is pending data waiting to be written, QAbstractSocket will enter ClosingState and wait until all data has been written. Eventually, it will enter UnconnectedState and emit the disconnected() signal.

See also connectToHost().

Upstream PySide2 reference signatures (binding differences may apply):

disconnectFromHost(self) -> None

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

disconnected

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

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

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractSocket::disconnected()

This signal is emitted when the socket has been disconnected.

Warning: If you need to delete the sender() of this signal in a slot connected to it, use the deleteLater() function.

See also connectToHost(), disconnectFromHost(), and abort().

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

error

error() -> Any

X.error()

Supplemental documentation: Qt 5 reference:

QAbstractSocket::SocketError QAbstractSocket::error() const

Returns the type of error that last occurred.

See also state() and errorString().

Upstream PySide2 reference signatures (binding differences may apply):

error(self) -> PySide2.QtNetwork.QAbstractSocket.SocketError

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

errorOccurred

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

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

Supplemental documentation: Qt 5 reference:

[signal] void QAbstractSocket::errorOccurred(QAbstractSocket::SocketError socketError)

This signal is emitted after an error occurred. The socketError parameter describes the type of error that occurred.

When this signal is emitted, the socket may not be ready for a reconnect attempt. In that case, attempts to reconnect should be done from the event loop. For example, use a QTimer::singleShot() with 0 as the timeout.

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

This function was introduced in Qt 5.15.

See also error(), errorString(), and Creating Custom Qt Types.

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