I've written a quick ip/port scan for a specific device on my network, using
Sockets. What i do is trying to create a socket to a specific port for each
ip adress i can find, and if it connects within a small timeout of 15ms, it'
probably my device, and i send some commands to verify.

I start with this:

/Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.IP);
IAsyncResult ias = socket.BeginConnect(ip, 4201, null, null);/

and then i try the AsyncWaitHandle:

/ias.AsyncWaitHandle.WaitOne(15, true))/

to try and get the connection. If this returns true, my connection is valid.
Problem is, this code works perfectly on the simulator, but on the actual
iPhone device, it fails the AsyncWaitHandle() with the following exception:

/System.NotSupportedException: Linked away at
System.Threading.WaitHandle.WaitOne (Int32 millisecondsTimeout, Boolean
exitContext) [0x00000]/

What am i doing wrong?



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/IAsyncResult-exception-on-device-on-simulator-is-ok-tp3856964p3856964.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to