PC Review


Reply
Thread Tools Rate Thread

How: Affecting TcpClient Connect( ) timeout ?

 
 
Lee Gillie
Guest
Posts: n/a
 
      2nd May 2005
I have seen some suggest you use the ReadTimeout and WriteTimeout
properties to control this, but I have tried this, and it does not work.
I have a difficult to reproduce scenario where connection attempts are
hanging for 5 minutes before eventually failing. I need a much shorter
timeout on my client.

I think the delay is that the server has partially started negotiating
the connection - the OS has answered the call, but the bind has not
passed off the incoming connection request to the server process yet.
The server runs on VMS.
 
Reply With Quote
 
 
 
 
Lee Gillie
Guest
Posts: n/a
 
      3rd May 2005
Lee Gillie wrote:
> I have seen some suggest you use the ReadTimeout and WriteTimeout
> properties to control this, but I have tried this, and it does not work.
> I have a difficult to reproduce scenario where connection attempts are
> hanging for 5 minutes before eventually failing. I need a much shorter
> timeout on my client.
>
> I think the delay is that the server has partially started negotiating
> the connection - the OS has answered the call, but the bind has not
> passed off the incoming connection request to the server process yet.
> The server runs on VMS.


Ok, I think I figure this out.

One wants to make a Socket and manually connect it asynchronously using
BeginConnect. A manual reset event can then time the attempt to connect,
and stall the caller until either the asynchronous connect activity
occurs, or else the timed manual reset event wait expires. Once a
manually connected socket has been made, the next issue is how to get
the TcpClient to use it. There is a Client property on TcpClient, but
one must derive a from TcpClient to use it. I simply wrapped up all the
timeout enabled connect methods in this wrapper class. I provided
overlaods to the base class Connect routines which add a timeout
parameter. I chose to exclude the DNS work from the timeout.

- Lee
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to setup C# TCPClient timeout =?Utf-8?B?R2Vvcmdl?= Microsoft C# .NET 8 13th Aug 2007 09:13 PM
TcpClient timeout? Danny Tuppeny Microsoft C# .NET 2 9th Oct 2005 07:28 PM
TCPCLIENT and timeout Peter Stojkovic Microsoft VB .NET 3 10th Mar 2005 06:03 PM
TCPClient - Write timeout Niklas Microsoft Dot NET Compact Framework 3 27th Oct 2004 09:01 PM
How can i implement the timeout in TCPClient? Shine choi Microsoft Dot NET Compact Framework 1 4th Sep 2003 06:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:32 AM.