Re: Problem with application trying to read data from a network stream when the socket is closed
- From: White Spirit <wspirit@xxxxxxxxxxxxxxxx>
- Date: Wed, 13 Dec 2006 20:51:32 -0800
Nicholas Paldino [.NET/C# MVP] wrote:
I recommend using the NetworkStream, and reading byte by byte yourself, parsing apart the new line on your own. If the socket disconnects, then no more bytes will be returned to you (if the socket is closed).
That would solve the problem in terms of program execution. I don't understand why Socket.Connected wouldn't return false in the example code, though. In the program I'm writing, it will leave a thread running unnecessarily and because of the way the data is expected to be received, I can't use a timeout to close it.
.
- References:
- Problem with application trying to read data from a network stream when the socket is closed
- From: White Spirit
- Re: Problem with application trying to read data from a network stream when the socket is closed
- From: Nicholas Paldino [.NET/C# MVP]
- Problem with application trying to read data from a network stream when the socket is closed
- Prev by Date: Re: Please help asap.
- Next by Date: Re: Modifier mixture
- Previous by thread: Re: Problem with application trying to read data from a network stream when the socket is closed
- Next by thread: insert a movie file as a binary data in an xml
- Index(es):