Re: Stream selectively stopping read?
- From: "Alexander Nickolov" <agnickolov@xxxxxxxx>
- Date: Fri, 21 Jul 2006 14:14:36 -0700
Right after the previous packet left obviously. E.g. the next
4 bytes in your buffer (and note you may have only 1-3 bytes
available, so you may have to wait for the next chunk from
recv before you can construct the length of your next packet).
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Daniel" <DanielV@xxxxxxxxxxxxxxxx> wrote in message
news:O%23of2hQrGHA.4236@xxxxxxxxxxxxxxxxxxxxxxx
So how do you know when the start of the next bit of data is in order to
read the first 4 bytes and get the length?
"Alexander Nickolov" <agnickolov@xxxxxxxx> wrote in message
news:%23jETAeQrGHA.4540@xxxxxxxxxxxxxxxxxxxxxxx
Discarding data is where you go wrong obviously. The point
in the stream for each read is random - it doesn't have to
correspond to your packet headers.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Daniel" <DanielV@xxxxxxxxxxxxxxxx> wrote in message
news:eLHf2tOrGHA.2440@xxxxxxxxxxxxxxxxxxxxxxx
I read my buffer and keep reading in for the data length and then on
completing that i check the next 4 bytes for datalength and if that
returns 0 then i discard the rest of the buffer until the next receive
where i start again.
Is this wrong?
"Daniel" <DanielV@xxxxxxxxxxxxxxxx> wrote in message
news:upDeI$ArGHA.3604@xxxxxxxxxxxxxxxxxxxxxxx
Hey guys
i have a tcp stream between client and server.
i am finding that when i send data to the server it receives fine then
sends back and client receives fine.
Now if i repeat that it works one more time. Repeat again and the
server continues to receive, the client continues to send but the reply
from server vanishes, the server says it sent it, there are no issues
during send and yet the client does not receive.
Why would this happen on a stream? The server still says the socket is
connected, which it must be for the client to still be sending and
accordingly it is able to reply down that socket. Yet nothing at the
client end.
Even more strangely if i now send a different command to the sevrer
that will go through and the reply from the server is read and handled
by the client?
Any ideas!?
.
- References:
- Stream selectively stopping read?
- From: Daniel
- Re: Stream selectively stopping read?
- From: Daniel
- Re: Stream selectively stopping read?
- From: Alexander Nickolov
- Re: Stream selectively stopping read?
- From: Daniel
- Stream selectively stopping read?
- Prev by Date: Re: How Streams are received
- Next by Date: Re: Fundamentals question, is this how it works?
- Previous by thread: Re: Stream selectively stopping read?
- Next by thread: Getting a list of files in a directory on FTP server
- Index(es):
Relevant Pages
|