MCPcopy Create free account
hub / github.com/ReadyTalk/avian / doBind

Function doBind

classpath/java-nio.cpp:227–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227void doBind(JNIEnv* e, int s, sockaddr_in* address)
228{
229 {
230 int opt = 1;
231 int r = ::setsockopt(s,
232 SOL_SOCKET,
233 SO_REUSEADDR,
234 reinterpret_cast<char*>(&opt),
235 sizeof(int));
236 if (r != 0) {
237 throwIOException(e);
238 return;
239 }
240 }
241
242#ifdef SO_NOSIGPIPE
243 {
244 int opt = 1;
245 int r = ::setsockopt(s,
246 SOL_SOCKET,
247 SO_NOSIGPIPE,
248 reinterpret_cast<char*>(&opt),
249 sizeof(int));
250 if (r != 0) {
251 throwIOException(e);
252 return;
253 }
254 }
255#endif
256
257 {
258 int r
259 = ::bind(s, reinterpret_cast<sockaddr*>(address), sizeof(sockaddr_in));
260 if (r != 0) {
261 throwIOException(e);
262 return;
263 }
264 }
265}
266
267void doListen(JNIEnv* e, int s)
268{

Calls 2

throwIOExceptionFunction · 0.85
bindFunction · 0.85

Tested by

no test coverage detected