35 public QAbstractSocketEngineReceiver
37 Q_DECLARE_PUBLIC(QAbstractSocket)
39 QAbstractSocketPrivate(
decltype(QObjectPrivateVersion) version = QObjectPrivateVersion);
40 virtual ~QAbstractSocketPrivate();
43 inline void readNotification() override { canReadNotification(); }
44 inline void writeNotification() override { canWriteNotification(); }
45 inline void exceptionNotification() override {}
46 inline void closeNotification() override { canCloseNotification(); }
47 void connectionNotification() override;
48#ifndef QT_NO_NETWORKPROXY
49 inline void proxyAuthenticationRequired(
const QNetworkProxy &proxy, QAuthenticator *authenticator) override {
51 emit q->proxyAuthenticationRequired(proxy, authenticator);
55 virtual bool bind(
const QHostAddress &address, quint16 port, QAbstractSocket::BindMode mode,
56 const QNetworkInterface *iface =
nullptr);
58 virtual bool canReadNotification();
59 bool canWriteNotification();
60 void canCloseNotification();
63 void _q_connectToNextAddress();
64 void _q_startConnecting(
const QHostInfo &hostInfo);
65 void _q_testConnection();
66 void _q_abortConnectionAttempt();
68 bool emittedReadyRead =
false;
69 bool emittedBytesWritten =
false;
71 bool abortCalled =
false;
72 bool pendingClose =
false;
74 QAbstractSocket::PauseModes pauseMode = QAbstractSocket::PauseNever;
79 QList<QHostAddress> addresses;
81 quint16 localPort = 0;
83 QHostAddress localAddress;
84 QHostAddress peerAddress;
87 QAbstractSocketEngine *socketEngine =
nullptr;
88 qintptr cachedSocketDescriptor = -1;
90#ifndef QT_NO_NETWORKPROXY
92 QNetworkProxy proxyInUse;
94 void resolveProxy(
const QString &hostName, quint16 port);
96 inline void resolveProxy(
const QString &, quint16) { }
98 inline void resolveProxy(quint16 port) { resolveProxy(QString(), port); }
100 void resetSocketLayer();
101 virtual bool flush();
103 bool initSocketLayer(QAbstractSocket::NetworkLayerProtocol protocol);
104 virtual void configureCreatedSocket();
105 void startConnectingByName(
const QString &host);
106 void fetchConnectionParameters();
107 bool readFromSocket();
108 virtual bool writeToSocket();
109 void emitReadyRead(
int channel = 0);
110 void emitBytesWritten(qint64 bytes,
int channel = 0);
112 void setError(QAbstractSocket::SocketError errorCode,
const QString &errorString);
113 void setErrorAndEmit(QAbstractSocket::SocketError errorCode,
const QString &errorString);
115 qint64 readBufferMaxSize = 0;
116 bool isBuffered =
false;
117 bool hasPendingData =
false;
118 bool hasPendingDatagram =
false;
120 quint32 bytesWrittenEmissionCount = 0;
122 QTimer *connectTimer =
nullptr;
124 int hostLookupId = -1;
126 QAbstractSocket::SocketType socketType = QAbstractSocket::UnknownSocketType;
127 QAbstractSocket::SocketState state = QAbstractSocket::UnconnectedState;
130 QAbstractSocket::SocketError socketError = QAbstractSocket::UnknownSocketError;
132 QAbstractSocket::NetworkLayerProtocol preferredNetworkLayerProtocol =
133 QAbstractSocket::UnknownNetworkLayerProtocol;
135 bool prePauseReadSocketNotifierState =
false;
136 bool prePauseWriteSocketNotifierState =
false;
137 bool prePauseExceptionSocketNotifierState =
false;
138 static void pauseSocketNotifiers(QAbstractSocket*);
139 static void resumeSocketNotifiers(QAbstractSocket*);
140 static QAbstractSocketEngine* getSocketEngine(QAbstractSocket*);