1826631 Members
3400 Online
109695 Solutions
New Discussion

gethostbyaddr

 
kamal_15
Regular Advisor

gethostbyaddr

hi all

i want to know how can i use function:
gethostbyaddr
to know which IP address login server


kamal
2 REPLIES 2
steven Burgess_2
Honored Contributor

Re: gethostbyaddr

Hello

man gethostbyaddr

Regards

Steve

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=140137
take your time and think things through
rick jones
Honored Contributor

Re: gethostbyaddr

If you mean you want to know the IP address of the client who has logged-in to the server, gethostbyaddr() is not what you want to use.

If you have written your own application, when it calls accept(), the remote IP address will be returned as one of the parameters from accept() - see "man accept" for more on that.

If you have an application that has simply been handed a socket descriptor - say as its standard in (stdin) then you can try getpeeraddr() which will return the remote IP address associated with that socket.

If you mean to try to do somethine else, we'll need more details.
there is no rest for the wicked yet the virtuous have no pillows