Skip to content

PythonQt.QtNetwork.QLocalServer · declarations 001

Back to PythonQt.QtNetwork.QLocalServer

GroupAccessOption instance-attribute

GroupAccessOption: Any

OtherAccessOption instance-attribute

OtherAccessOption: Any

SocketOptions instance-attribute

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

UserAccessOption instance-attribute

UserAccessOption: Any

WorldAccessOption instance-attribute

WorldAccessOption: Any

close

close() -> None

X.close()

Supplemental documentation: Qt 5 reference:

void QLocalServer::close()

Stop listening for incoming connections. Existing connections are not affected, but any new connections will be refused.

See also isListening() and listen().

Upstream PySide2 reference signatures (binding differences may apply):

close(self) -> None

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

destroyed

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

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

errorString

errorString() -> str

X.errorString() -> str

Supplemental documentation: Qt 5 reference:

QString QLocalServer::errorString() const

Returns the human-readable message appropriate to the current error reported by serverError(). If no suitable string is available, an empty string is returned.

See also serverError().

Upstream PySide2 reference signatures (binding differences may apply):

errorString(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#errorString

fullServerName

fullServerName() -> str

X.fullServerName() -> str

Supplemental documentation: Qt 5 reference:

QString QLocalServer::fullServerName() const

Returns the full path that the server is listening on.

Note: This is platform specific

See also listen() and serverName().

Upstream PySide2 reference signatures (binding differences may apply):

fullServerName(self) -> str

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

hasPendingConnections

hasPendingConnections() -> bool

X.hasPendingConnections() -> bool

Supplemental documentation: Qt 5 reference:

[virtual] bool QLocalServer::hasPendingConnections() const

Returns true if the server has a pending connection; otherwise returns false.

See also nextPendingConnection() and setMaxPendingConnections().

Upstream PySide2 reference signatures (binding differences may apply):

hasPendingConnections(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#hasPendingConnections

incomingConnection

incomingConnection(socketDescriptor: int) -> None

X.incomingConnection(socketDescriptor)

Supplemental documentation: Qt 5 reference:

[virtual protected] void QLocalServer::incomingConnection(quintptr socketDescriptor)

This virtual function is called by QLocalServer when a new connection is available. socketDescriptor is the native socket descriptor for the accepted connection.

The base implementation creates a QLocalSocket, sets the socket descriptor and then stores the QLocalSocket in an internal list of pending connections. Finally newConnection() is emitted.

Reimplement this function to alter the server's behavior when a connection is available.

See also newConnection(), nextPendingConnection(), and QLocalSocket::setSocketDescriptor().

Upstream PySide2 reference signatures (binding differences may apply):

incomingConnection(self, socketDescriptor: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#incomingConnection

isListening

isListening() -> bool

X.isListening() -> bool

Supplemental documentation: Qt 5 reference:

bool QLocalServer::isListening() const

Returns true if the server is listening for incoming connections otherwise false.

See also listen() and close().

Upstream PySide2 reference signatures (binding differences may apply):

isListening(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#isListening

listen

listen(name: Any) -> bool

X.listen(name) -> bool

Supplemental documentation: Qt 5 reference:

bool QLocalServer::listen(const QString \&name)

Tells the server to listen for incoming connections on name. If the server is currently listening then it will return false. Return true on success otherwise false.

name can be a single name and QLocalServer will determine the correct platform specific path. serverName() will return the name that is passed into listen.

Usually you would just pass in a name like "foo", but on Unix this could also be a path such as "/temporary/foo" and on Windows this could be a pipe path such as "\\.\pipe\foo"

Note: On Unix if the server crashes without closing listen will fail with AddressInUseError. To create a new server the file should be removed. On Windows two local servers can listen to the same pipe at the same time, but any connections will go to one of the server.

See also serverName(), isListening(), and close().

bool QLocalServer::listen(qintptr socketDescriptor)

Instructs the server to listen for incoming connections on socketDescriptor. The property returns false if the server is currently listening. It returns true on success; otherwise, it returns false. The socket must be ready to accept new connections with no extra platform-specific functions called. The socket is set into non-blocking mode.

serverName(), fullServerName() may return a string with a name if this option is supported by the platform; otherwise, they return an empty QString.

This function was introduced in Qt 5.0.

See also isListening() and close().

Upstream PySide2 reference signatures (binding differences may apply):

listen(self, name: str) -> bool
listen(self, socketDescriptor: int) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#listen

maxPendingConnections

maxPendingConnections() -> int

X.maxPendingConnections() -> int

Supplemental documentation: Qt 5 reference:

int QLocalServer::maxPendingConnections() const

Returns the maximum number of pending accepted connections. The default is 30.

See also setMaxPendingConnections() and hasPendingConnections().

Upstream PySide2 reference signatures (binding differences may apply):

maxPendingConnections(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#maxPendingConnections

newConnection

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

Native PythonQt.QtNetwork.QLocalServer.newConnection; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QLocalServer::newConnection()

This signal is emitted every time a new connection is available.

See also hasPendingConnections() and nextPendingConnection().

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#newConnection

nextPendingConnection

nextPendingConnection() -> Any

X.nextPendingConnection() -> PythonQt.QtNetwork.QLocalSocket

Supplemental documentation: Qt 5 reference:

[virtual] QLocalSocket *QLocalServer::nextPendingConnection()

Returns the next pending connection as a connected QLocalSocket object.

The socket is created as a child of the server, which means that it is automatically deleted when the QLocalServer object is destroyed. It is still a good idea to delete the object explicitly when you are done with it, to avoid wasting memory.

nullptr is returned if this function is called when there are no pending connections.

See also hasPendingConnections(), newConnection(), and incomingConnection().

Upstream PySide2 reference signatures (binding differences may apply):

nextPendingConnection(self) -> PySide2.QtNetwork.QLocalSocket

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#nextPendingConnection

objectNameChanged

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

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

removeServer

removeServer(name: str) -> bool

X.removeServer(name) -> bool

Supplemental documentation: Qt 5 reference:

[static] bool QLocalServer::removeServer(const QString \&name)

Removes any server instance that might cause a call to listen() to fail and returns true if successful; otherwise returns false. This function is meant to recover from a crash, when the previous server instance has not been cleaned up.

On Windows, this function does nothing; on Unix, it removes the socket file given by name.

Warning: Be careful to avoid removing sockets of running instances.

This function was introduced in Qt 4.5.

Upstream PySide2 reference signatures (binding differences may apply):

removeServer(name: str) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#removeServer

serverError

serverError() -> Any

X.serverError()

Supplemental documentation: Qt 5 reference:

QAbstractSocket::SocketError QLocalServer::serverError() const

Returns the type of error that occurred last or NoError.

See also errorString().

Upstream PySide2 reference signatures (binding differences may apply):

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

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#serverError

serverName

serverName() -> str

X.serverName() -> str

Supplemental documentation: Qt 5 reference:

QString QLocalServer::serverName() const

Returns the server name if the server is listening for connections; otherwise returns QString()

See also listen() and fullServerName().

Upstream PySide2 reference signatures (binding differences may apply):

serverName(self) -> str

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

setMaxPendingConnections

setMaxPendingConnections(numConnections: int) -> None

X.setMaxPendingConnections(numConnections)

Supplemental documentation: Qt 5 reference:

void QLocalServer::setMaxPendingConnections(int numConnections)

Sets the maximum number of pending accepted connections to numConnections. QLocalServer will accept no more than numConnections incoming connections before nextPendingConnection() is called.

Note: Even though QLocalServer will stop accepting new connections after it has reached its maximum number of pending connections, the operating system may still keep them in queue which will result in clients signaling that it is connected.

See also maxPendingConnections() and hasPendingConnections().

Upstream PySide2 reference signatures (binding differences may apply):

setMaxPendingConnections(self, numConnections: int) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#setMaxPendingConnections

setSocketOptions

setSocketOptions(options: Any) -> None

X.setSocketOptions(options)

Upstream PySide2 reference signatures (binding differences may apply):

setSocketOptions(self, options: PySide2.QtNetwork.QLocalServer.SocketOptions) -> None

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#setSocketOptions

socketOptions instance-attribute

socketOptions: Any

Qt 5 reference:

socketOptions : SocketOptions

The setSocketOptions method controls how the socket operates. For example the socket may restrict access to what user ids can connect to the socket.

These options must be set before listen() is called.

In some cases, such as with Unix domain sockets on Linux, the access to the socket will be determined by file system permissions, and are created based on the umask. Setting the access flags will override this and will restrict or permit access as specified.

Other Unix-based operating systems, such as macOS, do not honor file permissions for Unix domain sockets and by default have WorldAccess and these permission flags will have no effect.

On Windows, UserAccessOption is sufficient to allow a non elevated process to connect to a local server created by an elevated process run by the same user. GroupAccessOption refers to the primary group of the process (see TokenPrimaryGroup in the Windows documentation). OtherAccessOption refers to the well known "Everyone" group.

By default none of the flags are set, access permissions are the platform default.

This property was introduced in Qt 5.0.

Access functions:

QLocalServer::SocketOptions socketOptions() const
void setSocketOptions(QLocalServer::SocketOptions options)

See also listen().

QLocalServer::SocketOptions QLocalServer::socketOptions() const

Returns the socket options set on the socket.

Note: Getter function for property socketOptions.

This function was introduced in Qt 5.0.

See also setSocketOptions().

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#socketOptions

waitForNewConnection

waitForNewConnection(msec: int, timedOut: Any) -> bool

X.waitForNewConnection(msec, timedOut) -> bool

Supplemental documentation: Qt 5 reference:

bool QLocalServer::waitForNewConnection(int msec \= 0, bool *timedOut \= nullptr)

Waits for at most msec milliseconds or until an incoming connection is available. Returns true if a connection is available; otherwise returns false. If the operation timed out and timedOut is not nullptr, *timedOut will be set to true.

This is a blocking function call. Its use is ill-advised in a single-threaded GUI application, since the whole application will stop responding until the function returns. waitForNewConnection() is mostly useful when there is no event loop available.

The non-blocking alternative is to connect to the newConnection() signal.

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

See also hasPendingConnections() and nextPendingConnection().

Upstream PySide2 reference signatures (binding differences may apply):

waitForNewConnection(self, msec: int) -> typing.Tuple[bool, bool]

Source: https://doc.qt.io/archives/qt-5.15/qlocalserver.html#waitForNewConnection