Determine sockets in use by python

Antoine Pitrou solipsis at pitrou.net
Fri Oct 1 16:37:53 CEST 2010


On Thu, 30 Sep 2010 12:32:45 -0700
Jim Mellander <jmellander at lbl.gov> wrote:
> Thanks, I realized that even if I found out relevant info on the
> socket, I would probably need to use ctypes to  provide a low level
> interface to select, as the socket wouldn't be a python socket object,
> unless there is some way to promote a c socket to a python socket
> object.
> 
> Appreciate the info, folks.

You can also try to monkeypatch the socket module (before importing the
3rd-party library) and replace the socket.socket() constructor with a
custom one which tracks all created sockets in a structure of your
choice.

Not very pretty of course.





More information about the Python-list mailing list