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_p.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_P_H
5#define QLOCALSERVER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the QLocalServer class. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtNetwork/private/qtnetworkglobal_p.h>
19
20#include "qlocalserver.h"
21#include "private/qobject_p.h"
22#include <qqueue.h>
23
24QT_REQUIRE_CONFIG(localserver);
25
26#if defined(QT_LOCALSOCKET_TCP)
27# include <qtcpserver.h>
28# include <QtCore/qmap.h>
29#elif defined(Q_OS_WIN)
30# include <qt_windows.h>
31# include <qwineventnotifier.h>
32#else
33# include <private/qabstractsocketengine_p.h>
34# include <qsocketnotifier.h>
35#endif
36
38
40{
41 Q_DECLARE_PUBLIC(QLocalServer)
42
43public:
45#if !defined(QT_LOCALSOCKET_TCP) && !defined(Q_OS_WIN)
47#endif
48 maxPendingConnections(30), error(QAbstractSocket::UnknownSocketError),
49 socketOptions(QLocalServer::NoOptions)
50 {
51 }
52
53 void init();
54 bool listen(const QString &name);
55 bool listen(qintptr socketDescriptor);
56 static bool removeServer(const QString &name);
57 void closeServer();
58 void waitForNewConnection(int msec, bool *timedOut);
59 void _q_onNewConnection();
60
61#if defined(QT_LOCALSOCKET_TCP)
62
63 QTcpServer tcpServer;
64 QMap<quintptr, QTcpSocket*> socketMap;
65#elif defined(Q_OS_WIN)
66 struct Listener {
67 Listener() = default;
68 HANDLE handle = nullptr;
69 OVERLAPPED overlapped;
70 bool connected = false;
71 private:
72 Q_DISABLE_COPY(Listener)
73 };
74
75 void setError(const QString &function);
76 bool addListener();
77
78 std::vector<std::unique_ptr<Listener>> listeners;
79 HANDLE eventHandle;
80 QWinEventNotifier *connectionEventNotifier;
81#else
82 void setError(const QString &function);
83
86#endif
87
91 QQueue<QLocalSocket*> pendingConnections;
94 int listenBacklog = 50;
95
96 Q_OBJECT_BINDABLE_PROPERTY(QLocalServerPrivate, QLocalServer::SocketOptions, socketOptions)
97};
98
100
101#endif // QLOCALSERVER_P_H
102
QList< QtAndroidInput::GenericMotionEventListener * > listeners
bool connected
The QAbstractSocket class provides the base functionality common to all socket types.
SocketError
This enum describes the socket errors that can occur.
void waitForNewConnection(int msec, bool *timedOut)
static bool removeServer(const QString &name)
void setError(const QString &function)
QQueue< QLocalSocket * > pendingConnections
QAbstractSocket::SocketError error
QSocketNotifier * socketNotifier
The QLocalServer class provides a local socket based server.
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QTcpServer class provides a TCP-based server.
Definition qtcpserver.h:22
\inmodule QtCore
Combined button and popup list for selecting options.
void * HANDLE
GLuint64 GLenum void * handle
GLuint name
#define Q_OBJECT_BINDABLE_PROPERTY(...)
Definition qproperty.h:1239
#define QT_REQUIRE_CONFIG(feature)
ptrdiff_t qintptr
Definition qtypes.h:166
if(qFloatDistance(a, b)<(1<< 7))
[0]
QObject::connect nullptr
socketLayer listen()