Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qlocalserver.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QLOCALSERVER_H
5#define QLOCALSERVER_H
6
7#include <QtNetwork/qtnetworkglobal.h>
8#include <QtNetwork/qabstractsocket.h>
9
10#include <QtCore/qproperty.h>
11
12QT_REQUIRE_CONFIG(localserver);
13
15
16class QLocalSocket;
18
19class Q_NETWORK_EXPORT QLocalServer : public QObject
20{
22 Q_DECLARE_PRIVATE(QLocalServer)
23 Q_PROPERTY(SocketOptions socketOptions READ socketOptions WRITE setSocketOptions
24 BINDABLE bindableSocketOptions)
25
27 void newConnection();
28
29public:
31 NoOptions = 0x0,
32 UserAccessOption = 0x01,
33 GroupAccessOption = 0x2,
34 OtherAccessOption = 0x4,
35 WorldAccessOption = 0x7,
36 AbstractNamespaceOption = 0x8
37 };
38 Q_ENUM(SocketOption)
39 Q_DECLARE_FLAGS(SocketOptions, SocketOption)
40 Q_FLAG(SocketOptions)
41
42 explicit QLocalServer(QObject *parent = nullptr);
44
45 void close();
46 QString errorString() const;
47 virtual bool hasPendingConnections() const;
48 bool isListening() const;
49 bool listen(const QString &name);
50 bool listen(qintptr socketDescriptor);
51 int maxPendingConnections() const;
52 virtual QLocalSocket *nextPendingConnection();
53 QString serverName() const;
54 QString fullServerName() const;
55 static bool removeServer(const QString &name);
56 QAbstractSocket::SocketError serverError() const;
57 void setMaxPendingConnections(int numConnections);
58 bool waitForNewConnection(int msec = 0, bool *timedOut = nullptr);
59
60 void setListenBacklogSize(int size);
61 int listenBacklogSize() const;
62
63 void setSocketOptions(SocketOptions options);
64 SocketOptions socketOptions() const;
65 QBindable<SocketOptions> bindableSocketOptions();
66
67 qintptr socketDescriptor() const;
68
69protected:
70 virtual void incomingConnection(quintptr socketDescriptor);
71 void addPendingConnection(QLocalSocket *socket);
72
73private:
74 Q_DISABLE_COPY(QLocalServer)
75 Q_PRIVATE_SLOT(d_func(), void _q_onNewConnection())
76};
77
78Q_DECLARE_OPERATORS_FOR_FLAGS(QLocalServer::SocketOptions)
79
81
82#endif // QLOCALSERVER_H
83
SocketError
This enum describes the socket errors that can occur.
The QLocalServer class provides a local socket based server.
The QLocalSocket class provides a local socket.
\inmodule QtCore
Definition qobject.h:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint name
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_FLAG(x)
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
size_t quintptr
Definition qtypes.h:167
ptrdiff_t qintptr
Definition qtypes.h:166
QTcpSocket * socket
[1]
socketLayer listen()