[python-win32] Waiting for Wireless

Thomas Heller theller at ctypes.org
Wed Oct 25 21:52:32 CEST 2006


Tim Roberts schrieb:
> As a self-proclaimed studly Win32 programmer, I'm embarrassed at not
> being able to find a neat solution to this.  I come to you humbly,
> seeking coolness.
> 
> I have a script on my laptop that runs after login and launches the
> tools that I use all the time, including the putty password agent, the
> Agent newsreader, and Firefox.  My wireless card takes about 15 seconds
> to sync up with my access point and get an IP address, by which time my
> script is done and the tools are running.  That means that Firefox
> always comes up complaining that it couldn't reach my home page.  So,
> I'd like to have my script wait for connectivity before launching the
> tools.  The question is, how can that be done?
> 
> I could use os.system to poll the "ipconfig" command, but that's icky
> and not at all studly.  I could loop on gethostaddr for localhost until
> it gets an IP, but even that's not studly, because there's no way to
> know that it's really the wireless adapter's IP address.
> 
> There must be a way for me to ask the musical question, "does the
> network adapter called 'Wireless Network Adapter' have an IP address?" 
> Does anybody know that tune?
> 

I have a module lying around that does this.  Should work on 2k and XP, at least.
You call it with the 'friendly name' of the network adaper, and it displays the
ip address and network mask (IIRC).  Should be easy to adapt to our needs, and more.

Thomas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: adapterinfo.py
Url: http://mail.python.org/pipermail/python-win32/attachments/20061025/a420a4fd/attachment.pot 


More information about the Python-win32 mailing list