[Tutor] question about socket status
Monika Jisswel
monjissvel at googlemail.com
Thu Jul 24 09:51:32 CEST 2008
if networking code is inside of the kernel then its from the kernel that you
can get network information & nowhere else.
(http://www.linuxdevcenter.com/pub/a/linux/2000/11/16/LinuxAdmin.html)
<http://www.linuxdevcenter.com/pub/a/linux/2000/11/16/LinuxAdmin.html>
I would just add that to see what netstat does simply use "strace netstat"
it will probably tell you the interesting files it reads when run.
2008/7/23 arsyed <arsyed at gmail.com>:
> On Mon, Jul 21, 2008 at 1:25 PM, Rupp, Romaine <Romaine.Rupp at arrisi.com>
> wrote:
> > Hello,
> >
> > I am new to programming with python and sockets.
> >
> > I would like to determine the status of a socket as it is returned when
> you
> > do 'netstat –a | grep <port#>'. I would like to know if the socket
> state
> > is ESTABLISHED, LISTEN , CLOSE_WAIT, etc.
> >
> > Is there a way to get this information through a socket call?
> >
> > I've tried using socket.getperrname() function, but that only tells if
> there
> > is a connection.
> >
> > Is there a way to get more information on the state of the socket
> > connection?
> >
>
>
> If you're on linux, you could try poking around /proc/net. See, for
> example:
>
> http://www.linuxdevcenter.com/pub/a/linux/2000/11/16/LinuxAdmin.html
>
> But I think invoking netstat and parsing the output from python might
> work well enough.
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080724/138fc3c9/attachment-0001.htm>
More information about the Tutor
mailing list