48 #ifndef QT_NO_LOCALSERVER 126 d->pendingConnections.clear();
128 d->serverName.clear();
129 d->fullServerName.clear();
130 d->errorString.clear();
144 return d->errorString;
156 return !(
d->pendingConnections.isEmpty());
179 d->pendingConnections.enqueue(socket);
192 return !(
d->serverName.isEmpty());
220 qWarning(
"QLocalServer::listen() called when already listening");
227 d->errorString =
tr(
"%1: Name error").
arg(
function);
231 if (!
d->listen(name)) {
232 d->serverName.clear();
233 d->fullServerName.clear();
237 d->serverName =
name;
250 return d->maxPendingConnections;
280 if (
d->pendingConnections.isEmpty())
283 #ifndef QT_LOCALSOCKET_TCP 285 if(!
d->socketNotifier)
288 if (
d->pendingConnections.size() <=
d->maxPendingConnections)
290 d->socketNotifier->setEnabled(
true);
292 d->connectionEventNotifier->setEnabled(
true);
328 return d->serverName;
341 return d->fullServerName;
371 d->maxPendingConnections = numConnections;
400 d->waitForNewConnection(msec, timedOut);
402 return !
d->pendingConnections.isEmpty();
409 #include "moc_qlocalserver.cpp"
virtual bool hasPendingConnections() const
Returns true if the server has a pending connection; otherwise returns false.
QIntegerForSizeof< void * >::Unsigned quintptr
#define QT_END_NAMESPACE
This macro expands to.
QString serverName() const
Returns the server name if the server is listening for connections; otherwise returns QString() ...
int maxPendingConnections() const
Returns the maximum number of pending accepted connections.
void close()
Stop listening for incoming connections.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
void newConnection()
This signal is emitted every time a new connection is available.
The QObject class is the base class of all Qt objects.
void setMaxPendingConnections(int numConnections)
Sets the maximum number of pending accepted connections to numConnections.
The QLocalSocket class provides a local socket.
~QLocalServer()
Destroys the QLocalServer object.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString fullServerName() const
Returns the full path that the server is listening on.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool waitForNewConnection(int msec=0, bool *timedOut=0)
Waits for at most msec milliseconds or until an incoming connection is available. ...
static bool removeServer(const QString &name)
Removes any server instance that might cause a call to listen() to fail and returns true if successfu...
SocketError
This enum describes the socket errors that can occur.
Q_CORE_EXPORT void qWarning(const char *,...)
The QLocalServer class provides a local socket based server.
bool listen(const QString &name)
Tells the server to listen for incoming connections on name.
QLocalServer(QObject *parent=0)
Create a new local socket server with the given parent.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
QString errorString() const
Returns the human-readable message appropriate to the current error reported by serverError().
bool isListening() const
Returns true if the server is listening for incoming connections otherwise false. ...
virtual void incomingConnection(quintptr socketDescriptor)
This virtual function is called by QLocalServer when a new connection is available.
QAbstractSocket::SocketError serverError() const
Returns the type of error that occurred last or NoError.
virtual QLocalSocket * nextPendingConnection()
Returns the next pending connection as a connected QLocalSocket object.
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
bool setSocketDescriptor(quintptr socketDescriptor, LocalSocketState socketState=ConnectedState, OpenMode openMode=ReadWrite)
static bool removeServer(const QString &name)