Hi,
This may be a simple question, but how do I determine the port numbers,
and IP addresses from a (struct socket)socket?
I appreciate any advice. Thank you,
Cliffe.
--
El Mon, Mar 16, 2009 at 10:03:31PM +0800 Cliffe ha dit:
> This may be a simple question, but how do I determine the port numbers,
> and IP addresses from a (struct socket)socket?
i'm far from being a networking expert, so i might be plain
wrong. after having a look at the kernel sources i think it works in
the following way:
struct inet_sock *inet = inet_sk(socket->sk);
the data you are looking for are:
inet->saddr
inet->sport
inet->daddr
inet->dport
btw: for these kind of questions it is better to write to the
kernelnewbies list ([email protected])
best regards
--
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona
Anyone who has never made a mistake has never tried anything new
(Albert Einstein)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-