Pipes, sockets and coms processes

Rich Stevens rstevens at noao.edu
Sun Jan 13 00:04:52 AEST 1991


In article <1180 at brchh104.bnr.ca> rbs at aiai.ed.ac.uk (Robert Scott) writes:
>My question is:
>
>Given two processes communicating via a socket, how does the receiver know
>the length of the senders message?

The answer is: it depends on the underlying protocol being used with the
socket.  If you're using a stream protocol such as TCP, there are no
record boundaries at all provided by the system.  The applications at both
ends have to build them and use them.  Common examples are newlines to
mark lines with ascii text or one or more count bytes in front of every
record.  If you're using a datagram protocol such as UDP, each datagram
can be considered a "record".  But, beware of lots of other subtleties if
you use a datagram approach (loss of datagrams, buffer space, etc.).
Sounds like what you're looking for is something like Xerox's SPP--a
reliable protocol with record boundaries.  But, Suns don't come with it.

	Rich Stevens



More information about the Comp.sys.sun mailing list