Hi, DNS resolution is done sync, even for the async socket methods, which is why execution hangs if you try an invalid/non-existing IP. The solution here is to actually call client.Socket.BeginConnect on a different thread (in the threadpool for instance), this way the main thread won't get blocked if anything goes wrong.
I hope this helps, Rolf On Wed, Feb 1, 2012 at 8:45 PM, MojoDK <[email protected]> wrote: > Hi, > > If I run this code on an invalid (or non existing) IP ... > > client.Socket.BeginConnect(client.Address, client.Port, ConnectCallback, > client); > > ... the execution just halts/freeze. > > What is best practice to async connect and handle timeouts? I need to close > everything down nicely, so the client.Socket is ready to handle a new IP > address. > > Thanks! > :) > Mojo > > -- > View this message in context: > http://monotouch.2284126.n4.nabble.com/Async-TcpClient-freeze-tp4349147p4349147.html > Sent from the MonoTouch mailing list archive at Nabble.com. > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch >
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
