Re: TcpClient read/write timeouts do not timeout
- From: Zytan <zytanlithium@xxxxxxxxx>
- Date: Mon, 21 Jul 2008 10:10:49 -0700 (PDT)
(It appears my reply isn't appearing, so I'll write again:)
Hard to say without seeing an actual concise-but-complete code example.
I use the code from this example:
http://msdn.microsoft.com/en-us/library/system.net.sockets.tcpclient.aspx
(except I implement timeouts.)
Are you having
read/write problems or connection problems?
It connects fine. The server sees the connection. The client gets
stuck in the stream.Write() call, and the server never sees any data
from it. (This occurs 1% o the time. The other 99%, everything works
fine.)
Beware of using the TCP timeout: once the timeout occurs, the socket is no
longer usable.
Ok.
Depending on your intent, you may be better off
implementing timeout logic yourself elsewhere.
The implementation is: 1. connect, 2. send data, 3. get reply, 4.
disconnect, so TcpClient seemed like the answer, since it was
synchronous, just as I wanted it to be, to avoid the hassle of
asynchronous code.
I even TURNED THE SERVER OFF once the stream.Write() got hung up, to
see if that would end the stream.Write() call... and it doesn't.
Write() should end because there's NO server and because the timeout
is 1 minute, and it's been 20 minutes now. Even if my server code is
a mess of bugs, this makes no sense.
Thanks, Pete,
Zytan
.
- References:
- TcpClient read/write timeouts do not timeout
- From: Zytan
- Re: TcpClient read/write timeouts do not timeout
- From: Peter Duniho
- TcpClient read/write timeouts do not timeout
- Prev by Date: MapPath not working with ASP.NET MVC
- Next by Date: Re: TcpClient read/write timeouts do not timeout
- Previous by thread: Re: TcpClient read/write timeouts do not timeout
- Next by thread: Re: TcpClient read/write timeouts do not timeout
- Index(es):
Relevant Pages
|