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 <[EMAIL PROTECTED]>: > On Mon, Jul 21, 2008 at 1:25 PM, Rupp, Romaine <[EMAIL PROTECTED]> > 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@python.org > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor