LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-28-2001, 12:20 PM   #1
jmdey
LQ Newbie
 
Registered: Jan 2001
Location: india
Posts: 9

Rep: Reputation: 0
Question 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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration