- if ((tserv = getservbyname("time", "tcp")) == NULL) /* find port # */
- perror_msg_and_die("%s", "time");
-
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */
- perror_msg_and_die("%s", "socket");
+ s_in.sin_port = htons(37); /* find port # */
+ if ((tserv = getservbyname("time", "tcp")) != NULL)
+ s_in.sin_port = tserv->s_port;