🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #11761

XDR and select?

#11761
From: Joel Loo
Date: Thu, 30 Mar 1989 03:13
34 lines
2296 bytes
I have been using the xdr (external data representation) on a network of
SUN3 workstations for passing of data. I like it a lot. I created xdr
record streams around sockets and use the socket as abstract data stream
(?). I like in particular: xdr routines are bidirectional, saving the time
needed to write pairs of input/output routines.

I encounter one problem which I hope some of you can help:

In a program I have a few sockets and each has an xdr struct associated.
Naturally I used a loop and call 'select' to wait for input from the
sockets. Whenever a socket becomes alive, its corresponding xdr is used to
read a record and process it. However, records got choked up in the xdr
internal buffers once in a while because xdr routines often reads pass
record boundary (for the sake of filling up internal buffer). I appreciate
the xdr buffering effort but this chokes up small records in the buffer
very often. A choked record is processed only later when the next record
in the stream writes into the socket and trigger the 'select' call.

Although no records got lost, the application I am working on needs to
process the records as soon as they come in. Is there any suggestion to
get rid of this choking?

Thanks in advance.

PS. I had tried 'xdrrec_eof' hoping that it is written precisely for this
situation, ie. to test if the internal buffer is empty; but it seems to do
something else.  Also, specifying the buffer size to 1 char (or smaller
than the smallest record size) helps but are there some other ways? If
possible I would like to keep using xdr, select, and not touching the xdr
internals.

MCC                            |   Email:  loo@sw.mcc.com
3500 West Balcones Centre Dr.  |   Voice:  (512)338-3680 (O)
Austin, TX 78759               |           (512)343-1780 (H)
Technical Details
Message-ID: <2092@mister-curious.sw.mcc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request
From: loo@mcc.com (Joel Loo)
Newsgroups: comp.sys.sun
Subject: XDR and select?
Keywords: Software
Message-ID: <2092@mister-curious.sw.mcc.com>
Date: 30 Mar 89 03:13:50 GMT
Sender: usenet@rice.edu
Organization: MCC, Austin, TX
Lines: 34
Approved: Sun-Spots@rice.edu
Original-Date: 8 Mar 89 23:10:33 GMT
X-Sun-Spots-Digest: Volume 7, Issue 213, message 12 of 15