On Tue, Sep 19, 2000 at 06:17:35PM -0700, Alex JuniorBurger wrote:
> Hi,
> this is a question for sockets programmers
> (preferably C). Is it possible to retrieve the IP of a
> host, given a connected socket?
> Please send CC any replies to my email address.
There are two functions you want.
getpeername - get name of connected peer
this gives you a sockaddr structure with the details of the otherend
and
getsockname - get socket name
this gives you a sockaddr structure with the details of this end
useful if you're doing evil things like transperant proxying
and you want to see what ip they where actually trying to connect to.
> PS. this question may be a little inappropriate, but
> the W95 machine I am on currently gives me no access
> to nntp servers
It's vaugely linuxy.
--
John
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug