sockets

  • Thread starter Thread starter Jose
  • Start date Start date
J

Jose

How do I put a timeout in the method listes in a socket to be closed
in 30 seconds? thanks!!
 
Peter Duniho said:
If you search this newsgroup for past discussions involving "socket" and
"timeout", you'll see the answers that have been posted previously.

The short version is: set a timer and close the socket after the desired
timeout occurs.

Or use BeginXYZ version of the function along with WaitHandle.WaitAny and a
TimeSpan. Then you can pass in other WaitHandle objects at the same time,
like a cancel ManualResetEvent (which could even be set from a different
process). Of course you'll still need to close the socket if the operation
didn't finish in time / user requested cancel.
 
Back
Top