sockets and packets

der Mouse mouse at thunder.mcrcim.mcgill.edu
Fri Jun 7 00:43:18 AEST 1991


In article <1991Jun5.055501.6003 at trl.oz.au>, psember at lynx.trl.OZ.AU (P Sember SNR) writes:

> If I am sending long files down a socket is it best to split the file
> into packets.

Is that a statement or a question?  (Usually when people phrase a
sentence as a question and end it with a period it's clear; in this
case it's not so clear - if you switch "is it" to "it is" it's no
longer phrased as a question.)

> What size and why for a sun4?

You don't say what system, you don't say what sort of socket, and you
don't say what's on the other end of the socket.  So I have to guess.

If the socket is a SOCK_STREAM (which is probably true in your case),
it generally doesn't matter; the implementation will break it up for
you.  There's no point in trying to second-guess it, because it has
access to information you don't that can affect the best way to break
it up.  The only case where you *need* to break it up is if you're
speaking to a daemon of some sort which sends stuff back every so
often; in this case you need to read the stuff being sent back or
there may be danger of deadlock.

If the socket is a SOCK_DGRAM, your attempt to write will generally
fail unless the amount of stuff you're writing is small enough.  If
you're using datagram sockets, though, you should already know that and
have a protocol design in hand which deals with all the hair necessary
to use the things and make them work.

If the socket is some other sort, I haven't a clue what's up.  The only
other sort of socket I can recall offhand is SOCK_RAW, and if you have
to ask questions like this you have no business messing with SOCK_RAW.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.unix.questions mailing list