regarding gethostbyname()

iam using gethostbyname for verifing whether net is active or not
it's work fine
but how it's work
i mean whether it is using ping or sending socket,
who it determining the internet .
thank u in advance
sree

If you mean it's checking whether your internet connection in general is working, that works because to look up most hostnames, it has to communicate with a DNS server over the internet. No internet, no name lookup. There are exceptions, of course. Entries in /etc/hosts get looked up from the file without asking a DNS server at all.

You have already asked this question in another thread and the rules prohibit duplicate posts.