path: root/src/network/socket/qnativesocketengine_p.h
diff options
authorThiago Macieira <>2014-12-24 16:43:57 -0200
committerThiago Macieira <>2015-03-04 23:58:11 +0000
commit126d489f7f561bc3967ee2a36624c3b1fa26f974 (patch)
tree1f4bd4c2d776c955c0edd830cfb233e8ba74a1ed /src/network/socket/qnativesocketengine_p.h
parent9fb68a90af79df3b8dc3225a3a97e2c6387afeec (diff)
Adjust the socket address family before bind()/connect()/sendto()
If our socket is already of a given type (probably due to a previous call to bind()), then constrain the incoming target address to be of the same family. On some OSs, trying to send or connect to an IPv4 address from an IPv6 socket will fail with EINVAL, even if the socket is not in "v6only" mode. bind() can't be called after already being bound, but the function can still be called on a socket created by the user and passed on with setSocketDescriptor(). Change-Id: I209a1f8d0c782c6b6de2b39ea4cfad74d63f3293 Reviewed-by: Richard J. Moore <>
Diffstat (limited to 'src/network/socket/qnativesocketengine_p.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index 4ec6023d4b..24909bf310 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -232,6 +232,7 @@ public:
void setError(QAbstractSocket::SocketError error, ErrorString errorString) const;
+ QHostAddress adjustAddressProtocol(const QHostAddress &address) const;
// native functions
int option(QNativeSocketEngine::SocketOption option) const;