3 #include <sys/socket.h>
4 #include <netinet/in.h>
8 init_sockaddr (struct sockaddr_in
*name
,
12 struct hostent
*hostinfo
;
14 name
->sin_family
= AF_INET
;
15 name
->sin_port
= htons (port
);
16 hostinfo
= gethostbyname (hostname
);
19 fprintf (stderr
, "Unknown host %s.\n", hostname
);
22 name
->sin_addr
= *(struct in_addr
*) hostinfo
->h_addr
;