home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_01_07 / 1n07034a < prev    next >
Text File  |  1990-10-16  |  477b  |  31 lines

  1.  
  2. LISTING 1
  3.  
  4. /* Connect a host with the network */
  5.  
  6. #include <sys/types.h>
  7. #include "pctcp/types.h"
  8. #include "pctcp/pctcp.h"
  9. #include "pctcp/sockets.h"
  10. #include "pctcp/error.h"
  11.  
  12. int connect(long addr)
  13. {
  14.     int nd;        /* network descriptor */
  15.  
  16.     struct addr a;
  17.  
  18.     a.fhost = addr;
  19.     a.fsocket = SOCK_TCP_FTP;
  20.     a.lsocket = 0;
  21.     a.protocol = STREAM;
  22.  
  23.     nd = net_connect(-1,STREAM, &a);
  24.     if (nd == -1) {
  25.         pneterror("net_connect");
  26.         exit(1);
  27.         }
  28.     return nd;
  29. }
  30.  
  31.