detecting socket in use on localhost

Alex Martelli aleaxit at yahoo.com
Mon Oct 4 05:59:04 EDT 2004


Berends <j at jochem.{N0SP4M}.tv> wrote:
   ...
> > If you need a cross-platform solution I think you'll need to adopt a
> > trial-and-error strategy.  Two main possibilities: 
   ...
> I found another solution and that is parse the netstat information on
> the host and grep the range of ports and see if something is returned.

Oh yes, an unstated corollary of my 'If' above was: if you don't care
about cross-platform portability AND are using a good platform, then
there are no doubt better solutions!


Alex



More information about the Python-list mailing list