I'm connected to my ISP as follows:

1. WLAN to one of their access points. They have a few of them around the city, if I scan I can see several of their APs, having a common essid part, and a few other APs from neighbours. Those APs have different signal quolity at different times, can disappear, etc. All in all very dynamic. Unencrypted.

2. get address over DHCP from the AP. This can fail too if the AP hangs, even though the wireless connection is possible.

3. VPN to a remote server over the AP. This can also fail even if you got an address from the AP.

4. With time the connection can break in any of the above links.

So, my task is - scan the environment on connect, find the best WLAN quolity AP, try to connect, if fail, scan again, try another one. Once connected, monitor internet reachability.

Are their any existing tools that can do this (possibly with slight source-code extensions)? If not, I'd program it in perl, I guess...

Any clues?