Re: Trying to get a 'to' IP address from a socket

Wichert Akkerman (androsyn@i95.com)
Tue, 20 Jul 1999 11:10:57 -0400 (EDT)


I think getpeername() is what your looking for.

See the man page in section 2 for it.

Aaron

On Tue, 20 Jul 1999, Fred Cohen wrote:

> I'm not on the list, so please respond directly to me.
>
> I am trying to figure out how to get a destination IP address from a
> socket that has been passed to me by another program. According to what
> I have been able to find out to date, the source IP address is easy to
> get, but the destination isn't available except through some fairly
> obscure set of system calls. No direct call seems to be available, but
> lsof seems to be able to generate this information by looking through
> the kernel structures. Does anybody out there have the code to do this
> - preferably a few simple system calls - alternatively a very short C
> program - last alternative a hairy complex beast...
>
> FC
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/