8#if defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP)
9#include <QtCore/qt_windows.h>
150 d->socketOptions = options;
162 return d->socketOptions;
168 return &
d->socketOptions;
196#if defined(QT_LOCALSOCKET_TCP)
197 return d->tcpServer.socketDescriptor();
198#elif defined(Q_OS_WIN)
199 const auto handle =
d->connectionEventNotifier->handle();
202 return d->socketNotifier->socket();
218 d->pendingConnections.clear();
220 d->serverName.clear();
221 d->fullServerName.clear();
222 d->errorString.clear();
236 return d->errorString;
248 return !(
d->pendingConnections.isEmpty());
271 d->pendingConnections.enqueue(
socket);
284 return !(
d->serverName.isEmpty());
311 qWarning(
"QLocalServer::listen() called when already listening");
315 if (
name.isEmpty()) {
318 d->errorString =
tr(
"%1: Name error").arg(
function);
322 if (!
d->listen(
name)) {
323 d->serverName.clear();
324 d->fullServerName.clear();
328 d->serverName =
name;
354 qWarning(
"QLocalServer::listen() called when already listening");
358 d->serverName.clear();
359 d->fullServerName.clear();
377 return d->maxPendingConnections;
404 if (
d->pendingConnections.isEmpty())
407#ifndef QT_LOCALSOCKET_TCP
408 if (
d->pendingConnections.size() <=
d->maxPendingConnections)
410 d->socketNotifier->setEnabled(
true);
412 d->connectionEventNotifier->setEnabled(
true);
445 return d->serverName;
458 return d->fullServerName;
488 d->maxPendingConnections = numConnections;
517 d->waitForNewConnection(msec, timedOut);
519 return !
d->pendingConnections.isEmpty();
536 d->listenBacklog =
size;
549 return d->listenBacklog;
554#include "moc_qlocalserver.cpp"
SocketError
This enum describes the socket errors that can occur.
virtual bool setSocketDescriptor(qintptr socketDescriptor, SocketState state=ConnectedState, OpenMode openMode=ReadWrite)
Initializes QAbstractSocket with the native socket descriptor socketDescriptor.
static bool removeServer(const QString &name)
The QLocalServer class provides a local socket based server.
QString fullServerName() const
Returns the full path that the server is listening on.
bool waitForNewConnection(int msec=0, bool *timedOut=nullptr)
Waits for at most msec milliseconds or until an incoming connection is available.
QString errorString() const
Returns the human-readable message appropriate to the current error reported by serverError().
virtual void incomingConnection(quintptr socketDescriptor)
This virtual function is called by QLocalServer when a new connection is available.
void newConnection()
This signal is emitted every time a new connection is available.
QLocalServer(QObject *parent=nullptr)
Create a new local socket server with the given parent.
SocketOptions socketOptions
the socket options that control how the socket operates.
QAbstractSocket::SocketError serverError() const
Returns the type of error that occurred last or NoError.
void setSocketOptions(SocketOptions options)
void setListenBacklogSize(int size)
Sets the backlog queue size of to be accepted connections to size.
QBindable< SocketOptions > bindableSocketOptions()
int maxPendingConnections() const
Returns the maximum number of pending accepted connections.
virtual bool hasPendingConnections() const
Returns true if the server has a pending connection; otherwise returns false.
QString serverName() const
Returns the server name if the server is listening for connections; otherwise returns QString()
int listenBacklogSize() const
Returns the backlog queue size of to be accepted connections.
static bool removeServer(const QString &name)
~QLocalServer()
Destroys the QLocalServer object.
bool listen(const QString &name)
Tells the server to listen for incoming connections on name.
virtual QLocalSocket * nextPendingConnection()
Returns the next pending connection as a connected QLocalSocket object.
void close()
Stop listening for incoming connections.
qintptr socketDescriptor() const
bool isListening() const
Returns true if the server is listening for incoming connections otherwise false.
void setMaxPendingConnections(int numConnections)
Sets the maximum number of pending accepted connections to numConnections.
The QLocalSocket class provides a local socket.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qDeleteAll(list.begin(), list.end())
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
GLuint64 GLenum void * handle
GLenum GLuint GLintptr GLsizeiptr size
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent