help on gethostbyadress()
i am unable to get the hostname from the gethostbyaddress fn in unix
but the gethostbyname is working fine and am able to get the host ip from it!!
what cud be the problem
im putting the code here too
//dont worry the header files hav been included
main()
{
struct sockaddr_in sad;
struct hostent *p;
sad.family=AFD_INET ;
sad.sin_addr.s_addr=inet_addr"191.34.76.9");
sad.sin_port=htons(6000);
p=gethostbyaddress(&sad,sizeof(sad),AF_INET);
printf("%u",p); //here i get a null always!
}//dont worry the op can be pinged in my network!
|