Arpit
Arpit

Reputation: 4407

gethostbyname problem

I wish to use "gethostbyname" in my Suse m/c but it is not returning any structure.

but on the other systems it is working fine what could be the issue with my m/c ??

Upvotes: 0

Views: 2223

Answers (3)

Alexey Feldgendler
Alexey Feldgendler

Reputation: 1810

If “ping somehost” on the command line works for you, gethostbyname should work, too, when used correctly. Read manpage resolv.conf(5) for details on how to configure name resolution.

If you get ping working but your code still fails, please post an example.

Upvotes: 0

Arpit
Arpit

Reputation: 4407

To gethostbyname to work an entry in /etc/hosts to be made ... :) I was missing that thanks for answers.

Upvotes: 0

Aif
Aif

Reputation: 11220

Note that the new way of doing it is using getaddrinfo see beej guide

Upvotes: 3

Related Questions