Re: TCP question
- From: "Dan Barclay" <Dan@xxxxxxxx>
- Date: Mon, 20 Nov 2006 18:39:52 -0600
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).
.
- References:
- TCP question
- From: fniles
- Re: TCP question
- From: Bob Butler
- Re: TCP question
- From: David Kerber
- TCP question
- Prev by Date: Re: Detecting midnight
- Next by Date: Re: del not working in .bat file
- Previous by thread: Re: TCP question
- Next by thread: Re: TCP question
- Index(es):
Relevant Pages
|