MCPcopy Create free account
hub / github.com/crownengine/crown / set_blocking

Function set_blocking

src/core/network/socket.cpp:165–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163 }
164
165 void set_blocking(SOCKET socket, bool blocking)
166 {
167 CE_ENSURE(socket != INVALID_SOCKET);
168
169#if CROWN_PLATFORM_WINDOWS
170 u_long non_blocking = blocking ? 0 : 1;
171 int err = ioctlsocket(socket, FIONBIO, &non_blocking);
172 CE_ASSERT(err == 0, "ioctlsocket: last_error() = %d", last_error());
173 CE_UNUSED(err);
174#else
175 int flags = fcntl(socket, F_GETFL, 0);
176 fcntl(socket, F_SETFL, blocking ? (flags & ~O_NONBLOCK) : O_NONBLOCK);
177#endif
178 }
179
180 void set_reuse_address(SOCKET socket, bool reuse)
181 {

Callers 6

acceptMethod · 0.85
accept_nonblockMethod · 0.85
readMethod · 0.85
read_nonblockMethod · 0.85
writeMethod · 0.85
write_nonblockMethod · 0.85

Calls 1

last_errorFunction · 0.85

Tested by

no test coverage detected