MCPcopy Create free account
hub / github.com/MeisApps/pcbu-desktop / SetSocketBlocking

Method SetSocketBlocking

common/src/connection/BaseConnection.cpp:19–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19bool BaseConnection::SetSocketBlocking(SOCKET socket, bool isBlocking) {
20#ifdef WINDOWS
21 u_long mode = isBlocking ? 0 : 1;
22 return ioctlsocket(socket, FIONBIO, &mode) == 0;
23#else
24 int oldFlags = fcntl(socket, F_GETFL, 0);
25 if(oldFlags == -1)
26 return false;
27 auto flags = isBlocking ? (oldFlags & ~O_NONBLOCK) : (oldFlags | O_NONBLOCK);
28 return fcntl(socket, F_SETFL, flags) != -1;
29#endif
30}
31
32bool BaseConnection::SetSocketRWTimeout(SOCKET socket, uint32_t secs) {
33#ifdef WINDOWS

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected