MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / setSocketBlockingState

Function setSocketBlockingState

JUCE/modules/juce_core/network/juce_Socket.cpp:186–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184 }
185
186 static bool setSocketBlockingState (SocketHandle handle, bool shouldBlock) noexcept
187 {
188 #if JUCE_WINDOWS
189 u_long nonBlocking = shouldBlock ? 0 : (u_long) 1;
190 return ioctlsocket (handle, (long) FIONBIO, &nonBlocking) == 0;
191 #else
192 int socketFlags = fcntl (handle, F_GETFL, 0);
193
194 if (socketFlags == -1)
195 return false;
196
197 if (shouldBlock)
198 socketFlags &= ~O_NONBLOCK;
199 else
200 socketFlags |= O_NONBLOCK;
201
202 return fcntl (handle, F_SETFL, socketFlags) == 0;
203 #endif
204 }
205
206 #if ! JUCE_WINDOWS
207 static bool getSocketBlockingState (SocketHandle handle)

Callers 2

readSocketFunction · 0.85
connectSocketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected