Skip to content

PythonQt.QtNetwork.QLocalSocket · declarations 001

Back to PythonQt.QtNetwork.QLocalSocket

ConnectionError instance-attribute

ConnectionError: Any

LocalSocketError instance-attribute

LocalSocketError: 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

LocalSocketState instance-attribute

LocalSocketState: 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

PeerClosedError instance-attribute

PeerClosedError: Any

ServerNotFoundError instance-attribute

ServerNotFoundError: Any

abort

abort() -> None

X.abort()

Supplemental documentation: Qt 5 reference:

void QLocalSocket::abort()

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

See also disconnectFromServer() and close().

Upstream PySide2 reference signatures (binding differences may apply):

abort(self) -> None

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

aboutToClose

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

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

bytesAvailable

bytesAvailable() -> int

X.bytesAvailable() -> int

Supplemental documentation: Qt 5 reference:

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

Reimplements: QIODevice::bytesAvailable() const.

Upstream PySide2 reference signatures (binding differences may apply):

bytesAvailable(self) -> int

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

bytesToWrite

bytesToWrite() -> int

X.bytesToWrite() -> int

Supplemental documentation: Qt 5 reference:

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

Reimplements: QIODevice::bytesToWrite() const.

Upstream PySide2 reference signatures (binding differences may apply):

bytesToWrite(self) -> int

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

bytesWritten

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

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

canReadLine

canReadLine() -> bool

X.canReadLine() -> bool

Supplemental documentation: Qt 5 reference:

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

Reimplements: QIODevice::canReadLine() const.

Upstream PySide2 reference signatures (binding differences may apply):

canReadLine(self) -> bool

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

channelBytesWritten

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

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

channelReadyRead

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

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

close

close() -> None

X.close()

Supplemental documentation: Qt 5 reference:

[override virtual] void QLocalSocket::close()

Reimplements: QIODevice::close().

Upstream PySide2 reference signatures (binding differences may apply):

close(self) -> None

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

connectToServer

connectToServer(name: Any, openMode: Any) -> None

X.connectToServer(name, openMode)

Supplemental documentation: Qt 5 reference:

void QLocalSocket::connectToServer(QIODevice::OpenMode openMode \= ReadWrite)

Attempts to make a connection to serverName(). setServerName() must be called before you open the connection. Alternatively you can use connectToServer(const QString \&name, OpenMode openMode);

The socket is opened in the given openMode and first enters ConnectingState. If a connection is established, QLocalSocket enters ConnectedState and emits connected().

After calling this function, the socket can emit errorOccurred() to signal that an error occurred.

This function was introduced in Qt 5.1.

See also state(), serverName(), and waitForConnected().

void QLocalSocket::connectToServer(const QString \&name, QIODevice::OpenMode openMode \= ReadWrite)

This is an overloaded function.

Set the server name and attempts to make a connection to it.

The socket is opened in the given openMode and first enters ConnectingState. If a connection is established, QLocalSocket enters ConnectedState and emits connected().

After calling this function, the socket can emit errorOccurred() to signal that an error occurred.

See also state(), serverName(), and waitForConnected().

Upstream PySide2 reference signatures (binding differences may apply):

connectToServer(self, name: str, openMode: PySide2.QtCore.QIODevice.OpenMode=...) -> None
connectToServer(self, openMode: PySide2.QtCore.QIODevice.OpenMode=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlocalsocket.html#connectToServer

connected

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

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

Supplemental documentation: Qt 5 reference:

[signal] void QLocalSocket::connected()

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

See also connectToServer() and disconnected().

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

destroyed

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

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

disconnectFromServer

disconnectFromServer() -> None

X.disconnectFromServer()

Supplemental documentation: Qt 5 reference:

void QLocalSocket::disconnectFromServer()

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

See also connectToServer().

Upstream PySide2 reference signatures (binding differences may apply):

disconnectFromServer(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlocalsocket.html#disconnectFromServer

disconnected

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

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

Supplemental documentation: Qt 5 reference:

[signal] void QLocalSocket::disconnected()

This signal is emitted when the socket has been disconnected.

See also connectToServer(), disconnectFromServer(), abort(), and connected().

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

error

error() -> Any

X.error()

Supplemental documentation: Qt 5 reference:

QLocalSocket::LocalSocketError QLocalSocket::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.QLocalSocket.LocalSocketError

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

errorOccurred

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

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

Supplemental documentation: Qt 5 reference:

[signal] void QLocalSocket::errorOccurred(QLocalSocket::LocalSocketError socketError)

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

QLocalSocket::LocalSocketError 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/qlocalsocket.html#errorOccurred

flush

flush() -> bool

X.flush() -> bool

Supplemental documentation: Qt 5 reference:

bool QLocalSocket::flush()

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

Call this function if you need QLocalSocket 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 QLocalSocket 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/qlocalsocket.html#flush

fullServerName

fullServerName() -> str

X.fullServerName() -> str

Supplemental documentation: Qt 5 reference:

QString QLocalSocket::fullServerName() const

Returns the server path that the socket is connected to.

Note: The return value of this function is platform specific.

See also connectToServer() and serverName().

Upstream PySide2 reference signatures (binding differences may apply):

fullServerName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qlocalsocket.html#fullServerName

isSequential

isSequential() -> bool

X.isSequential() -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QLocalSocket::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/qlocalsocket.html#isSequential

isValid

isValid() -> bool

X.isValid() -> bool

Supplemental documentation: Qt 5 reference:

bool QLocalSocket::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() and connectToServer().

Upstream PySide2 reference signatures (binding differences may apply):

isValid(self) -> bool

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

objectNameChanged

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

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

open

open(openMode: Any) -> bool

X.open(openMode) -> bool

Supplemental documentation: Qt 5 reference:

[override virtual] bool QLocalSocket::open(QIODevice::OpenMode openMode \= ReadWrite)

Reimplements: QIODevice::open(QIODevice::OpenMode mode).

Equivalent to connectToServer(OpenMode mode). The socket is opened in the given openMode to the server defined by setServerName().

Note that unlike in most other QIODevice subclasses, open() may not open the device directly. The function return false if the socket was already connected or if the server to connect to was not defined and true in any other case. The connected() or errorOccurred() signals will be emitted once the device is actually open (or the connection failed).

See connectToServer() for more details.

Upstream PySide2 reference signatures (binding differences may apply):

open(self, openMode: PySide2.QtCore.QIODevice.OpenMode=...) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlocalsocket.html#open

readBufferSize

readBufferSize() -> int

X.readBufferSize() -> int

Supplemental documentation: Qt 5 reference:

qint64 QLocalSocket::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/qlocalsocket.html#readBufferSize

readChannelFinished

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

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

readData

readData(arg__1: str, arg__2: int) -> int

X.readData(arg__1, arg__2) -> int

Supplemental documentation: Qt 5 reference:

[override virtual protected] qint64 QLocalSocket::readData(char *data, qint64 c)

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

Upstream PySide2 reference signatures (binding differences may apply):

readData(self, arg__1: str, arg__2: int) -> int

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

readyRead

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

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

serverName

serverName() -> str

X.serverName() -> str

Supplemental documentation: Qt 5 reference:

QString QLocalSocket::serverName() const

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

See also setServerName(), connectToServer(), and fullServerName().

Upstream PySide2 reference signatures (binding differences may apply):

serverName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qlocalsocket.html#serverName

setReadBufferSize

setReadBufferSize(size: int) -> None

X.setReadBufferSize(size)

Supplemental documentation: Qt 5 reference:

void QLocalSocket::setReadBufferSize(qint64 size)

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

If the buffer size is limited to a certain size, QLocalSocket 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.

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/qlocalsocket.html#setReadBufferSize

setServerName

setServerName(name: str) -> None

X.setServerName(name)

Supplemental documentation: Qt 5 reference:

void QLocalSocket::setServerName(const QString \&name)

Set the name of the peer to connect to. On Windows name is the name of a named pipe; on Unix name is the name of a local domain socket.

This function must be called when the socket is not connected.

This function was introduced in Qt 5.1.

See also serverName().

Upstream PySide2 reference signatures (binding differences may apply):

setServerName(self, name: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlocalsocket.html#setServerName

setSocketDescriptor

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

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

Supplemental documentation: Qt 5 reference:

bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor, QLocalSocket::LocalSocketState socketState \= ConnectedState, QIODevice::OpenMode openMode \= ReadWrite)

Initializes QLocalSocket 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.

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

See also socketDescriptor(), state(), and openMode().

Upstream PySide2 reference signatures (binding differences may apply):

setSocketDescriptor(self, socketDescriptor: int, socketState: PySide2.QtNetwork.QLocalSocket.LocalSocketState=..., openMode: PySide2.QtCore.QIODevice.OpenMode=...) -> bool

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

socketDescriptor

socketDescriptor() -> int

X.socketDescriptor() -> int

Supplemental documentation: Qt 5 reference:

qintptr QLocalSocket::socketDescriptor() const

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

The socket descriptor is not available when QLocalSocket is in UnconnectedState. The type of the descriptor depends on the platform:

  • On Windows, the returned value is a Winsock 2 Socket Handle.
  • With WinRT and on INTEGRITY, the returned value is the QTcpSocket socket descriptor and the type is defined by socketDescriptor.
  • On all other UNIX-like operating systems, the type is a file descriptor representing a socket.

See also setSocketDescriptor().

Upstream PySide2 reference signatures (binding differences may apply):

socketDescriptor(self) -> int

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

state

state() -> Any

X.state()

Supplemental documentation: Qt 5 reference:

QLocalSocket::LocalSocketState QLocalSocket::state() const

Returns the state of the socket.

See also error().

Upstream PySide2 reference signatures (binding differences may apply):

state(self) -> PySide2.QtNetwork.QLocalSocket.LocalSocketState

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

stateChanged

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

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

Supplemental documentation: Qt 5 reference:

[signal] void QLocalSocket::stateChanged(QLocalSocket::LocalSocketState socketState)

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

QLocalSocket::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/qlocalsocket.html#stateChanged

waitForBytesWritten

waitForBytesWritten(msecs: int) -> bool

X.waitForBytesWritten(msecs) -> bool

Supplemental documentation: Qt 5 reference:

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

Reimplements: QIODevice::waitForBytesWritten(int msecs).

Upstream PySide2 reference signatures (binding differences may apply):

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

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

waitForConnected

waitForConnected(msecs: int) -> bool

X.waitForConnected(msecs) -> bool

Supplemental documentation: Qt 5 reference:

bool QLocalSocket::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->connectToServer("market");
if (socket->waitForConnected(1000))
    qDebug("Connected!");

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

See also connectToServer() and connected().

Upstream PySide2 reference signatures (binding differences may apply):

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

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