Determine sockets in use by python
jmellander at lbl.gov
Wed Sep 29 22:08:30 CEST 2010
Certainly not windows.... I'm developing on OS/X but for production
probably Linux and FreeBSD
(I'm hoping for something a bit more portable than running 'lsof' and
parsing the output, but appreciate any/all advice)
On Wed, Sep 29, 2010 at 11:05 AM, Gary Herron <gherron at digipen.edu> wrote:
> On 09/29/2010 09:50 AM, Jim Mellander wrote:
>> I'm a newbie to python, although not to programming. Briefly, I am
>> using a binding to an external library used for communication in a
>> client-server context, with the server in python. Typically, I would
>> set this up with event callbacks, and then enter a select loop, which,
>> most the time idles and processes input events when the socket shows
>> activity, kinda like:
>> while True:
>> Unfortunately, the API does not expose the socket to the script level,
>> and the developer recommends a busy loop:
>> while True:
>> which I hope to avoid, for many reasons. If the socket can be exposed
>> to the script level, then the problem would be solved.
>> Failing that, it would be nice to be able to pythonically determine
>> the sockets in use and select on those. Does anyone have any
>> suggestions on how to proceed?
>> Thanks in advance
> It's certain that any answer to this will depend on which operating system
> you are using. So do tell: What OS?
> Gary Herron, PhD.
> Department of Computer Science
> DigiPen Institute of Technology
> (425) 895-4418
More information about the Python-list