// Wrapper functions for Socket system calls. // // These functions assume any error is a fatal error! #include /* standard C i/o facilities */ #include /* needed for atoi() */ #include /* Unix System Calls */ #include /* system data type definitions */ #include /* socket specific definitions */ #include /* INET constants and stuff */ #include /* IP address conversion stuff */ int np_socket( int domain, int type, int protocol) { int sk; if ((sk = socket( PF_INET, SOCK_STREAM, 0 )) < 0) { perror("Problem creating socket\n"); exit(1); } return(sk); } int np_bind(int sd, const struct sockaddr *addr, int addrlen) { int retval; if ((retval = bind(sd, addr, addrlen))<0) { perror("Problem binding\n"); exit(1); } return(retval); }