dns
Vasilis Vasaitis
vvas at hal.csd.auth.gr
Sun Mar 7 18:21:20 EET 1999
On Sun, Mar 07, 1999 at 02:01:59AM +0000, Constantinos A. Kotsokalis wrote:
> Lucky man, to exw etoimo :-) Kanei hostname -> IP address & kai to
> antistrofo. Here it comes.
>
> ------------------------------------------------------------------
..[snip]..
> if ((addr = inet_addr(argv[1])) == INADDR_NONE){ /* hostname given */
> if ((hp = gethostbyname(argv[1])) == NULL){
> herror("gethostbyname"); /* invalid hostname */
> exit(h_errno);
> }
> }
> else { /* IP address given */
> if ((hp = gethostbyaddr((char *)&addr, 4, AF_INET)) == NULL){
> herror("gethostbyaddr"); /* invalid IP address */
> exit(h_errno);
> }
> }
Kale mou anthrope, i gethostbyaddr ti douleia exei edo pera? To
programma douleuei to idio kala an o parapano kodikas pou exo kanei quote
antikatastathei me to eksis tmima tou:
if ((hp = gethostbyname(argv[1])) == NULL){
herror("gethostbyname"); /* invalid hostname */
exit(h_errno);
}
>
> printf("Hostname: %s\n", hp->h_name);
..[snip]..
--
Vasilis Vasaitis
vvas at hal.csd.auth.gr
--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users
====================================================================
More information about the Linux-greek-users
mailing list