| 7041 | } |
| 7042 | |
| 7043 | static bool resetSocketOptions (const int handle, const bool isDatagram, const bool allowBroadcast) noexcept |
| 7044 | { |
| 7045 | const int sndBufSize = 65536; |
| 7046 | const int rcvBufSize = 65536; |
| 7047 | const int one = 1; |
| 7048 | |
| 7049 | return handle > 0 |
| 7050 | && setsockopt (handle, SOL_SOCKET, SO_RCVBUF, (const char*) &rcvBufSize, sizeof (rcvBufSize)) == 0 |
| 7051 | && setsockopt (handle, SOL_SOCKET, SO_SNDBUF, (const char*) &sndBufSize, sizeof (sndBufSize)) == 0 |
| 7052 | && (isDatagram ? ((! allowBroadcast) || setsockopt (handle, SOL_SOCKET, SO_BROADCAST, (const char*) &one, sizeof (one)) == 0) |
| 7053 | : (setsockopt (handle, IPPROTO_TCP, TCP_NODELAY, (const char*) &one, sizeof (one)) == 0)); |
| 7054 | } |
| 7055 | |
| 7056 | static bool bindSocketToPort (const int handle, const int port) noexcept |
| 7057 | { |
no outgoing calls
no test coverage detected