Re: Stream selectively stopping read?



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!?









.



Relevant Pages

  • [REVS] Backdoor Spotcom Analysis
    ... Spotcom is a backdoor client application that allows a hacker to control ... The server IP address is hard-coded in ... msrsvp.exe accepts a couple of command line arguments. ... the packet payload. ...
    (Securiteam)
  • Re: Socket weirdness
    ... client) before you will notice a shutdown receive at server. ... Then eventually a packet comes from the peer, and that will contain data, so the server responds RST: ... way back across the network. ...
    (microsoft.public.dotnet.framework)
  • Re: socket communication: socket doesnt connect
    ... Microsoft MVP, MCSD ... As far as your server code goes, ... accept the listening socket. ... Client client = new Client; ...
    (microsoft.public.vc.language)
  • Re: Strange problem drive me mad.
    ... not by the TCP layer. ... > Thanks for reply, actually, the problem is that client (may caused by ... > always flush data before I decode the each packet when buffer is full. ...
    (microsoft.public.win32.programmer.networks)
  • Re: SACK (and PF) wierdness
    ... the point where pf drops the packet because it sees a violation of the ... This is an active FTP data connection, from FTP server 192.168.1.10:20 ... to FTP client 192.168.1.200:64828, where payload is only flowing from ... This is a violation of the client's window by the server, ...
    (freebsd-net)