home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!fstop.csc.ti.com!pioneer!fcw
- From: fcw@telecom.ti.com (Fred Wedemeier)
- Subject: Re: Sending "datagrams" on a connected socket.
- Message-ID: <1992Sep2.182616.24007@csc.ti.com>
- Sender: usenet@csc.ti.com
- Nntp-Posting-Host: pioneer
- Reply-To: fcw@telecom.ti.com
- Organization: TI Telecom Systems, Dallas
- References: <1992Sep1.061951.6750@csc.ti.com>
- Date: Wed, 2 Sep 1992 18:26:16 GMT
- Lines: 41
-
- In article 6750@csc.ti.com, fcw@telecom.ti.com (Fred Wedemeier) writes:
- >
- > I need two processes to talk to each other in a "reliable,
- > flow-controlled, in-order, two-way" manner, quoting tcp(4). These
- > processes need to exchange discrete messages rather than boundary-less
- > streams of bytes.
- >
-
- and...
- >
- > 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.
-
- Well, what I was hoping for was advice on some combination of socket(),
- bind(), or whatever that would allow me to do the above with a single
- send()/recv(), once the socket was created and bound properly. I guess I
- didn't ask the question clearly enough.
-
- Many people were kind enough to reply with the almost unanimous
- suggestion to send() the byte count and then send() the text of the
- message. On the receiving side, recv() the fixed-size byte count and
- then ask for that number of bytes in another recv(). Thx. for the
- responses!
-
- In an application program, this would be sufficient since a connected
- socket guarantees sequential delivery of bytes. What I'm actually doing
- right now is building a comm API to be used by a group of programmers.
- The API needs to avoid the situation of an application program
- bypassing the API, communicating directly with the socket, and
- potentially getting the byte stream out of sync.
-
- So the clarified question is "can I send/receive a 'datagram' on a
- connected socket with an atomic send()/recv()?"
-
- If the answer is no, I'll probably hide the descriptor or put a USER
- BEWARE in the API documentation.
-
- ---
- Fred Wedemeier pho: 214-997-3213 fax: 214-997-3639
- timsg: fcw inet: fcw@pioneer.telecom.ti.com
-
-