diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-12-23 13:37:01 -0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-03-04 23:58:03 +0000 |
commit | 9fb68a90af79df3b8dc3225a3a97e2c6387afeec (patch) | |
tree | b51f4ca6effbcf2da792595837a92198a2181f01 /src/network/socket/qabstractsocket.h | |
parent | 29051bce39d24a6e33155feeec2833b79b55ff16 (diff) |
Fix bind+connect in both TCP and UDP
This has been known to be broken for a while. Now it works: you can bind
and you'll retain the port (and the file descriptor) for the connect
call. Incidentally, in fixing the binding for more than one IP for the
hostname (with event loop), this commit fixes the setSocketDescriptor
XFAIL.
[ChangeLog][QtNetwork] Fixed a bug that caused both QTcpSocket and
QUdpSocket to close the socket and lose any bound ports before
connecting. Now bind()/setSocketDescriptor() followed by connect() will
retain the original file descriptor.
Task-number: QTBUG-26538
Change-Id: I691caed7e8fd16a9cf687b5995afbf3006bf453a
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network/socket/qabstractsocket.h')
-rw-r--r-- | src/network/socket/qabstractsocket.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index 76b1e5f538..f3d7f13f48 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -135,9 +135,11 @@ public: PauseModes pauseMode() const; void setPauseMode(PauseModes pauseMode); + // ### Qt6: make the first one virtual bool bind(const QHostAddress &address, quint16 port = 0, BindMode mode = DefaultForPlatform); bool bind(quint16 port = 0, BindMode mode = DefaultForPlatform); + // ### Qt6: de-virtualize connectToHost(QHostAddress) overload virtual void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol); virtual void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite); virtual void disconnectFromHost(); |