Re: Reliability of Java, sockets and TCP transmissions
- From: Gordon Beaton <n.o.t@xxxxxxxxx>
- Date: 05 Oct 2007 14:16:11 GMT
On Fri, 5 Oct 2007 23:52:19 +1000, Qu0ll wrote:
So just how reliable are TCP and Java sockets over the actual
internet? I mean do I need to implement some kind of "advanced"
protocol whereby check sums are transmitted along with packets and
the packet retransmitted if the check sum is invalid or is all this
handled by either the Java sockets or the TCP protocol already?
"Java sockets" is a misnomer, since sockets are not specific to Java
or any other programming language. Java provides an interface to the
socket mechanism (sometimes called "Berkeley sockets") already
provided by your operating system.
TCP is a reliable protocol. It manages retransmission when data is out
of order, missing or corrupt, and it will break the connection when it
is unable to provide an error-free data stream, but not before making
a number of attempts to correct the situation first.
Your application can safely assume that as long as your connection is
up, your data stream contains exactly the data sent by the remote.
There are however a number of things that your application can do
wrong. The commonest ones to watch out for are thinking that TCP will
respect your message boundaries (it won't), or expecting that you'll
always read as much data as you requested (you won't).
/gordon
--
.
- Follow-Ups:
- References:
- Prev by Date: Eclipse caps toggle plugin
- Next by Date: Re: Eclipse caps toggle plugin
- Previous by thread: Reliability of Java, sockets and TCP transmissions
- Next by thread: Re: Reliability of Java, sockets and TCP transmissions
- Index(es):
Relevant Pages
|
|