241 |
sin.sin_port= htons(port); |
sin.sin_port= htons(port); |
242 |
memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); |
memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); |
243 |
|
|
244 |
if(do_connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { |
if(set_noblock(s) < 0) { |
245 |
goto error; |
goto error; |
246 |
} |
} |
247 |
|
|
248 |
if(set_noblock(s) < 0) { |
if(do_connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { |
249 |
goto error; |
goto error; |
250 |
} |
} |
251 |
|
|
305 |
unixsocket.sun_family= AF_UNIX; |
unixsocket.sun_family= AF_UNIX; |
306 |
snprintf(unixsocket.sun_path, sizeof(unixsocket.sun_path), "%s", pathname); |
snprintf(unixsocket.sun_path, sizeof(unixsocket.sun_path), "%s", pathname); |
307 |
|
|
308 |
if (do_connect(s, (struct sockaddr *)&unixsocket, sizeof(unixsocket)) < 0) { |
if(set_noblock(s) < 0) { |
309 |
goto error; |
goto error; |
310 |
} |
} |
311 |
|
|
312 |
if(set_noblock(s) < 0) { |
if(do_connect(s, (struct sockaddr *)&unixsocket, sizeof(unixsocket)) < 0) { |
313 |
goto error; |
goto error; |
314 |
} |
} |
315 |
|
|
323 |
|
|
324 |
|
|
325 |
/** |
/** |
326 |
* Creates a blocking server socket (SOCK_STREAM type) and bind it to |
* Create a blocking server socket and bind it to the specified local |
327 |
* the specified local port number, with the specified backlog. Set a |
* port number, with the specified backlog. Set a socket option to |
328 |
* socket option to make the port reusable again. If a bind address is |
* make the port reusable again. If a bind address is given the socket |
329 |
* given the socket will only accept connect requests to this |
* will only accept connect requests to this addresses. If the bind |
330 |
* addresses. If the bind address is NULL it will accept connections |
* address is NULL it will accept connections on any/all local |
331 |
* on any/all local addresses |
* addresses |
332 |
* @param port The localhost port number to open |
* @param port The localhost port number to open |
333 |
* @param backlog The maximum queue length for incomming connections |
* @param backlog The maximum queue length for incomming connections |
334 |
* @param bindAddr the local address the server will bind to |
* @param bindAddr the local address the server will bind to |