Re: file transfer protocol (not FTP) examples
Re: file transfer protocol (not FTP) examples
- Subject: Re: file transfer protocol (not FTP) examples
- From: Quinn <email@hidden>
- Date: Wed, 9 Jul 2003 08:34:43 +0100
At 18:33 -0400 26/6/03, Philip D. Wasson wrote:
I guess I'm mainly wondering how much I should be trusting TCP to
detect errors and keep the bytes in order.
Yes.
Is it really safe to essentially tell the receiver "OK, the file is
this many bytes long, sending now." and then just dump the file into
the socket (in reasonably-sized buffer-loads, of course).
Yes. TCP guarantees that either all of the data will arrive intact
and in order, or the connection will tear.
Sending a count before sending the data is generally a good idea.
That way the receiver can easily distinguish between the end of the
data and a torn connection. [A receiver that uses the APIs properly
can do this regardless, but having a length makes it more obvious.]
Should I need to worry about sliding windows, block retransmission, etc.,
No.
or will TCP take care of all that reasonably well?
Yes.
Any suggestions?
Not only is it *OK* to let TCP take care of this, but it's a really
*good idea*. The TCP protocol, and the implementations on various
platforms, have been carefully designed to accommodate a wide variety
of network conditions. Reimplementing this yourself is generally a
bad idea unless one of the following apply.
o you're a network protocol design expert, or
o your problem falls significantly outside of the scope of TCP
(for example, you want to send the same data to lots of machines, or
you are using tiny transactions)
For file transfer, it's generally best to just use TCP.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.