// Wrapper functions for Socket system calls.
//
// These functions assume any error is a fatal error!


#include <stdio.h>	/* standard C i/o facilities */
#include <stdlib.h>	/* needed for atoi() */
#include <unistd.h>	/* Unix System Calls */
#include <sys/types.h>	/* system data type definitions */
#include <sys/socket.h> /* socket specific definitions */
#include <netinet/in.h> /* INET constants and stuff */
#include <arpa/inet.h>	/* 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);
}


