Commit 6aa22732 authored by Kurt Pattyn's avatar Kurt Pattyn Committed by The Qt Project

Add SO_SNDBUF and SO_RCVBUF to socket options

Added functionality to set SO_SNDBUF and SO_RCVBUF
socket options on QAbstractSocket.

Task-number: QTBUG-34934
Change-Id: I2134fb462d43b9111c039cd7e7d36bd78eafd8bc
Reviewed-by: default avatarGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: default avatarRichard J. Moore <rich@kde.org>
parent d351f3a3
......@@ -372,9 +372,22 @@
IP_MULTICAST_LOOP (multicast loopback) socket option.
\value TypeOfServiceOption This option is not supported on
Windows. This maps to the IP_TOS socket option.
Windows. This maps to the IP_TOS socket option. For possible values,
see table below.
Possible values for the \e{TypeOfServiceOption} are:
\value SendBufferSizeSocketOption Sets the socket send buffer size
in bytes at the OS level. This maps to the SO_SNDBUF socket option.
This option does not affect the QIODevice or QAbstractSocket buffers.
This enum value has been introduced in Qt 5.3.
\value ReceiveBufferSizeSocketOption Sets the socket receive
buffer size in bytes at the OS level.
This maps to the SO_RCVBUF socket option.
This option does not affect the QIODevice or QAbstractSocket buffers
(see \l{QAbstractSocket::}{setReadBufferSize()}).
This enum value has been introduced in Qt 5.3.
Possible values for \e{TypeOfServiceOption} are:
\table
\header \li Value \li Description
......@@ -1902,6 +1915,14 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons
case TypeOfServiceOption:
d_func()->socketEngine->setOption(QAbstractSocketEngine::TypeOfServiceOption, value.toInt());
break;
case SendBufferSizeSocketOption:
d_func()->socketEngine->setOption(QAbstractSocketEngine::SendBufferSocketOption, value.toInt());
break;
case ReceiveBufferSizeSocketOption:
d_func()->socketEngine->setOption(QAbstractSocketEngine::ReceiveBufferSocketOption, value.toInt());
break;
}
}
......@@ -1936,6 +1957,14 @@ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option)
case TypeOfServiceOption:
ret = d_func()->socketEngine->option(QAbstractSocketEngine::TypeOfServiceOption);
break;
case SendBufferSizeSocketOption:
ret = d_func()->socketEngine->option(QAbstractSocketEngine::SendBufferSocketOption);
break;
case ReceiveBufferSizeSocketOption:
ret = d_func()->socketEngine->option(QAbstractSocketEngine::ReceiveBufferSocketOption);
break;
}
if (ret == -1)
return QVariant();
......
......@@ -115,7 +115,9 @@ public:
KeepAliveOption, // SO_KEEPALIVE
MulticastTtlOption, // IP_MULTICAST_TTL
MulticastLoopbackOption, // IP_MULTICAST_LOOPBACK
TypeOfServiceOption //IP_TOS
TypeOfServiceOption, //IP_TOS
SendBufferSizeSocketOption, //SO_SNDBUF
ReceiveBufferSizeSocketOption //SO_RCVBUF
};
enum BindFlag {
DefaultForPlatform = 0x0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment