After making an Asynchronous Call in C#, I would like to be able to test for Timeouts so I won’t wait indefinitely for an answer. Here is my code:
RemoteAsyncDelegate RemoteDel = new RemoteAsyncDelegate(obj.MethodHello);
// Call delegate to remote method
IAsyncResult RemAr = RemoteDel.BeginInvoke(null, null);
Console.WriteLine(RemoteDel.EndInvoke(RemAr));
Is there a way for EndInvoke to wait for a limited amount of time (Timeout)?
If not, is there an alternative way?
You may try the following;