Scanning for local servers, getting a broadcast address

Chris Lyon chris.lyon at spritenote.co.uk
Mon Jun 9 11:58:30 CEST 2003


I have a small group of machines both Linux and Windows moving large
files around a local network.

I wish to know which other machines on the local subnet are running
servers. I believe an approach to resolve this is a UDP broadcast and
indeed this seems to function acceptably.
However since I have to generate the broadcast address, I need to know
at least my subnet mask to allow me to derive the Broadcast address.

How do I do this in a pythonic fashion without recourse to reading
host files which seems very platform dependant?

I ask because I have a demo at a client who I know will be running a
255.255.255.240 subnet mask and I would like to be able to scan the
servers successfully without any pre-configaration on the software
part.

Yours in anticipation.

Chris Lyon




More information about the Python-list mailing list