lkml.org 
[lkml]   [1999]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Trying to get a 'to' IP address from a socket
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/

\
 
 \ /
  Last update: 2005-03-22 13:53    [from the cache]
©2003-2011 Jasper Spaans