Re: TCP question



See what the Bob(s) said.

I don't think you should think of sending messages with TCP. It's a stream.
You put something in one end and it comes out the other end, in order,
eventually. The stream just, by normal usage, gets loaded with data a
package at a time. Even that, if loaded a certain way, will lay in the
senders buffer (unsent) unless it's loaded with a flush command or more data
is put in that fills the buffer. It won't lay there forever (It'll time out
and be sent).

Along the way it breaks up the stream as it's configured (no relation to
your own message size!), sends the pieces to the other end, and the other
end reassembles them. Missing pieces are requested to be sent again, in
which case the missing piece is assembled with other stuff that got through
the first time.

The point is, by its nature it behaves more like a stream at the TCP level.
You have to use it in a specific way to get it to behave like a message
handler.

More here:

http://www.faqs.org/rfcs/rfc793.html

Dan




"David Kerber" <ns_dkerber@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:MPG.1fc7c1067c0d7e7f989a48@xxxxxxxxxxxxxxxxxxxxxx
In article <eOhre6mCHHA.472@xxxxxxxxxxxxxxxxxxxx>, tiredofit@xxxxxxxxxxx
says...
"fniles" <fniles@xxxxxxxxxx> wrote in message
news:uPBYv0mCHHA.5012@xxxxxxxxxxxxxxxxxxxx
I am using TCP control in VB6. I am sending a lot of messages every
milli seconds.
Sometimes (not very often) the messages received will be out of
order, and they are NOT received one after another. In between the
message, there are other messages.
Like the following example:

ABC,140425,140450,139800,LAST|
39850,,LAST| -->> incomplete and out of order, it should be after
the message below
ABC,140415,140440,139700,,LAST|
ABC,140430,140455,139815,,LAST|
ABC,140445,140470,139820,,LAST|
ABC,140425,140450,1 -->> incomplete and out of order, it should be
before the message above

Message "ABC,140425,140450,1" should appear before and be together
with "40125,,LAST| "
So, it should be "ABC,140425,140450,139850,,LAST|".

Is this how TCP works ?

No, TCP guarantees that the data is received in the order it is sent.
Show
the code you have for receiving the packets

No, it does not guarantee the order; just that they will be received
intact. Consecutive packets can even take different routes from sender
to receiver, which can easily change the receipt order. If one is lost
or damaged en route, it will request a resend of that particular packet,
and that can change the order as well.

I think the only time you can expect the order to be correct is if there
are no routers between the source and the destination, and I'm not even
sure if it's guaranteed even then.

--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).


.



Relevant Pages

  • Re: vaporware LOS question
    ... enter a store at the exact same time and the packets arrive at the server at the ... Also, TCP is connection oriented, not necessarily stream oriented. ... The issue of "oops, my stream has backed up packets, and the player wants to ...
    (rec.games.roguelike.development)
  • Re: Fundamentals question, is this how it works?
    ... processing packets after you are done with one. ... receving the buffer size each time. ... TCP is a stream-based protocol, which means that it ignores any attempt ... then the receiving side might get ...
    (microsoft.public.win32.programmer.networks)
  • Re: OS X packet sniffing tools
    ... which has the nice feature of being able to show the TCP ... ability to display the TCP stream. ... X11 though. ... Seems a bit heavy just to get some packets. ...
    (uk.comp.sys.mac)
  • Re: re0 fix that works with polling
    ... > that the switch was receiving (but I forgot to verify that it was sending ... > all packets to the gige port) all packets even w/ the final packet loss.. ... I don't think my macosx laptop can handle rendering the ... The best thing I can recommend is to just capture the stream. ...
    (freebsd-current)
  • Re: PeerGroupSendData - UDP or TCP?
    ... is TCP (not UDP) when calling PeerGroupSendData. ... Being built on TCP, all the packets will be gaurenteed to be delivered, ... The ordering at the receiving end is not gaurenteed. ...
    (microsoft.public.win32.programmer.networks)