home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!destroyer!gumby!yale!yale.edu!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.unix.programmer
- Subject: Re: Sending "datagrams" on a connected socket.
- Date: 1 Sep 1992 19:07:29 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 17
- Message-ID: <180f1hINNg8c@early-bird.think.com>
- References: <1992Sep1.061951.6750@csc.ti.com>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <1992Sep1.061951.6750@csc.ti.com> fcw@telecom.ti.com writes:
- >I can add a layer onto a stream or datagram socket, but it would be
- >nice if some incantation of socket library calls can do it instead.
- >Email or net help would be appreciated... Either suggestions how to do
- >it or a knowledgeable statement that it ain't possible.
-
- There's no built-in mechanism to delimit messages on a stream socket. It's
- trivial to add such a layer on top of it, though. Just send a byte or two
- containing the message length (depending on the max size of your messages)
- followed by that much data. If the length is two bytes, make sure you
- define a canonical byte order (e.g. use htons() and ntohs() to
- encode and decode the length).
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-