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 >
Wrap
Text File
|
1990-10-16
|
477b
|
31 lines
LISTING 1
/* Connect a host with the network */
#include <sys/types.h>
#include "pctcp/types.h"
#include "pctcp/pctcp.h"
#include "pctcp/sockets.h"
#include "pctcp/error.h"
int connect(long addr)
{
int nd; /* network descriptor */
struct addr a;
a.fhost = addr;
a.fsocket = SOCK_TCP_FTP;
a.lsocket = 0;
a.protocol = STREAM;
nd = net_connect(-1,STREAM, &a);
if (nd == -1) {
pneterror("net_connect");
exit(1);
}
return nd;
}