Socket.BeginConnect timeout

  • Thread starter Thread starter Clark
  • Start date Start date
C

Clark

Is there any way to abort a connection attempt after a few seconds if it
does not succeed?

When I call the BeginConnect method, if the remote endpoint does not exist,
it waits something like 20 seconds before returning an exception. Somehow I
would like to start a timer when the BeginConnect method is called, and if
it elapses before the connection is established, to abort the pool thread
that is executing the callback. How can I do this?

Clark
 
Back
Top