MCPcopy Create free account
hub / github.com/SmingHub/Sming / socket_blocking

Function socket_blocking

Sming/Arch/Host/Components/hostlib/sockets.cpp:78–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static bool socket_blocking(int fd, bool block)
79{
80#ifdef __WIN32
81 u_long iMode = block ? 0 : 1;
82 return ioctlsocket(fd, FIONBIO, &iMode) == 0;
83#else
84 int fl = fcntl(fd, F_GETFL);
85 int fl_new = block ? (fl & ~O_NONBLOCK) : (fl | O_NONBLOCK);
86 if(fl_new == fl)
87 return true;
88 return fcntl(fd, F_SETFL, fl_new) == 0;
89#endif
90}
91
92/*
93 * CSockAddr

Callers 2

setblockingMethod · 0.85
try_connectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected