|
How to Get the hostent data
Hi,
I am trying to write a program, to find the open port on any system. Rightnow, my programm is working fine on the same system ip.
Now, i want to enhanced it to get any IP address and perform the task.
Problem is that, i have only IP address, like "111:111:111:111".
From this how to get the struct hostent *he;
I have tried with the following code
//he = gethostbyname( compName );
unsigned int addr = inet_addr("111:111:111:111");
hostent *he = gethostbyaddr((char *) &addr, 4, AF_INET);
But getgostbyaddress is returning NULL.
Any body help me.
|