- if (!(h = gethostbyname(host))) { /* get the IP addr */
- perror_msg("%s", host);
- return(-1);
- }
- if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
- perror_msg("%s", "time");
- return(-1);
- }
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
- perror_msg("%s", "socket");
- return(-1);
- }