[python-win32] Waiting for Wireless
Jürgen Kareta
python at kareta.de
Wed Oct 25 20:20:00 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?
>
>
>
Hi Tim,
the win32api call GetIPAddrTable could be helpful. See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getipaddrtable.asp.
Unfortual it is currently not implemented in pywin. CTypes should be an
option.
Regards,
Jürgen
More information about the Python-win32
mailing list