Hi,

I have an application in which I need to connect to an access point
with a specific name. Therefor I start a scan
(WifiManager.startScan()) and listen to BroadCastEvents of type
SCAN_RESULTS_AVAILABLE_ACTION and NETWORK_STATE_CHANGED_ACTION.
When the scan results are available, I check if my AP is found and if
so I connect to it.

When I'm connected to the AP, I receive a NETWORK_STATE_CHANGED_ACTION
and there I open a SocketConnection to my serverSocket.
The problem I'm having is that on the moment that I'm connected to the
AP, the DHCP request is not yet finished. This causes the opening of
the socketConnection to throw a "SocketException: Network
unreachable".
A few moments later I see in the logcat logging: WifiStateTracker  -
DhcpHandler: DHCP request succeeded.
If I try to connect after this message, all goes fine.

Now my question is: is there an event that I can listen to that
informs me that the DHCP request is done?
Now I try to create a connection and while an error occurs I retry.
This is however very dangerous for hanging (if e.g the dhcp fails, the
loop will never stop...)

Any help?

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to