[python-win32] Get listening ports

le dahut le.dahut at laposte.net
Mon Jun 30 15:22:57 CEST 2008


I've found this : 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/392572

But maybe those APIs are available in pywin32 ?


Marcus Low wrote :
> 
> Hi,
> 
> Yup ip helpers the way, but alternatively if u want a simple routine, u 
> can launch the netstat -a -b after u createprocess with the appropriate 
> flags and pipe the information
> to ur buffer, then just parse the buffer and get the information, all 
> these can be done without seeing an ugly cmd console popping out. I have 
> the whole code in win32 C++ though, maybe there is an equivalent python 
> code around.
> 
> Marcus.
> 
> Tim Golden wrote:
>> le dahut wrote:
>>> Hello,
>>>
>>> I'm looking for an API that can do netstat calls to return a list of 
>>> listenign ports and maybe a process attached to it.
>>
>> You need the IP Helpers API
>>
>> http://msdn.microsoft.com/en-us/library/ms886687.aspx
>>
>> I'm afraid I've never used it, though, so you'll have
>> to scout around for examples.
>>
>> TJG



More information about the python-win32 mailing list