Re: Windows Sockets (TCPClient) problem.



That is not a problem. TCP guarantees that data will be sent in the right
order ( the order being sent ) & that it will reach the destination.

What TCP doesn't guarantee is the size of data. E.g. if you sent 8k of data
listener may call Receive multiple times, this depends on network
conditions, sliding window size etc ( for details look into RFC793 for the
tcp protocol description)

What you can do to solve the trouble is to read (Receive) data until you
will receive your 8192 bytes of data.

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

<mulham.haffar@xxxxxxxxx> wrote in message
news:1132402928.097883.179010@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> hi..
> im writing an application that uses tcpclient/tcplistener to send file
> via network, what im doing is dividing the file into small parts each
> part equals the buffer size (8192) and send the parts sequentialy.
> the problem is :
> the listener is detecting a stream to be read once every two times the
> sender sends a stream.
> I triend to fix it by sending one byte {0} before each send function
> and it worked because the listener ignores the first send (which is the
> 0 byte) then detects the next send which is the acutaul data, but i
> realized that the 0 byte is still in the buffer so its attached the
> next stream read.
> any help? any idea is appreciated .. thank you in advance.
>


.



Relevant Pages

  • Re: Algorithm for reading from continuous stream
    ... > I don't have much experience with reading from continuous stream (I ... > over bytes and the end of the buffer. ... TCP will give you a stream input. ... Repeat until request is satisfied. ...
    (comp.programming)
  • Re: Making sure you receive it all
    ... TCP connection represents a stream. ... Microsoft MVP, MCSD ... at the receiver the size in network byte order... ...
    (microsoft.public.win32.programmer.networks)
  • Re: recv() - How do you know the length of buffer that you are going to receive?
    ... a buffer in memory, or write to a file as you go. ... Then you can read 4 octets which represent the length ... Remember, if you're using TCP, it's a stream write bundaries at one end ...
    (comp.unix.programmer)
  • Re: Fundamentals question, is this how it works?
    ... That is what i thought i was saying that it receives it all in a stream ... receving the buffer size each time. ... receiving that many bytes i then break and wait for the next set of data to ... TCP is a stream-based protocol, which means that it ignores any attempt ...
    (microsoft.public.win32.programmer.networks)
  • Re: TCP question
    ... It's a stream. ... by its nature it behaves more like a stream at the TCP level. ... the code you have for receiving the packets ... Consecutive packets can even take different routes from sender ...
    (microsoft.public.vb.general.discussion)