/[monit]/monit/net.c
ViewVC logotype

Diff of /monit/net.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by hauk, Wed Jul 30 06:28:08 2003 UTC revision 1.25 by hauk, Thu Jul 31 00:32:13 2003 UTC
# Line 241  int create_socket(char *hostname, int po Line 241  int create_socket(char *hostname, int po
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    
# Line 305  int create_unix_socket(char *pathname) { Line 305  int create_unix_socket(char *pathname) {
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        
# Line 323  int create_unix_socket(char *pathname) { Line 323  int create_unix_socket(char *pathname) {
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

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26