Mike,
In order to do this, you will have to time the asynchronous event.
Basically, make a call to BeginConnect, and start a timer at the same time,
with an interval of your timeout.
In the timer function, set a flag indicating if the timer has fired.
Then, in the callback for the BeginConnect method, you check the flag.
If it is set, then you timed out, if not, then you haven't timed out.
You can then elaborate, by creating an Event that is set when the
timeout occurs, or the connection is created. Then, you have your thread
wait on both of those events. Depending on the event fired, you would then
know if there is a timeout, or if the connection succeeded.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Mike Schilling" <ap@newsgroup.nospam> wrote in message
news:Oy**************@TK2MSFTNGP15.phx.gbl...
How does one put a timeout on an attempt to connect a socket? There's no
timeout parameter to Socket.Connect(), and while there are socket options
for send and receive timeouts, there is none for connect timeout.