4 * Examine a socket and determine the name/address of the originating host.
10 void locate_host(char *tbuf, int client_socket)
12 struct sockaddr_in cs;
19 if (getpeername(client_socket, (struct sockaddr *) &cs, &len) < 0) {
20 strcpy(tbuf, "<unknown>");
23 if ((ch = gethostbyaddr((char *) &cs.sin_addr, sizeof(cs.sin_addr),
25 i = (char *) &cs.sin_addr;
30 sprintf(tbuf, "%d.%d.%d.%d", a1, a2, a3, a4);
33 safestrncpy(tbuf, ch->h_name, 64);