Prev: How to show the current line number with pdb.set_trace()
Next: help with the Python 3 version of the decorator module
From: moijes12 on 22 May 2010 03:38 Hi I need to get the details of Local Area connection information(network interface) like packets sent,packets recieved,duration etc. I have to do this in Windows using python. I tried looking under the socket module and also googling,but did not find anything that I could use for windows,though I did find something for linux.I have to somehow use the socket module for this. Please help me in cracking this. Regards Moses
From: sturlamolden on 22 May 2010 04:12 On 22 Mai, 09:38, moijes12 <moije...(a)gmail.com> wrote: > I need to get the details of Local Area connection information(network > interface) like packets sent,packets recieved,duration etc. I have to > do this in Windows using python. >>> import subprocess as sp >>> p = sp.Popen("netstat -s", shell=False, bufsize=4096, stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) >>> print ''.join(p.stdout.readlines()) >>> p.terminate() There are other switches for the netstat command as well.
From: moijes12 on 22 May 2010 04:17
On May 22, 1:12 pm, sturlamolden <stu...(a)molden.no> wrote: > On 22 Mai, 09:38, moijes12 <moije...(a)gmail.com> wrote: > > > I need to get the details of Local Area connection information(network > > interface) like packets sent,packets recieved,duration etc. I have to > > do this in Windows using python. > >>> import subprocess as sp > >>> p = sp.Popen("netstat -s", shell=False, bufsize=4096, > > stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE) > > >>> print ''.join(p.stdout.readlines()) > >>> p.terminate() > > There are other switches for the netstat command as well. Thanks Moses |