*BSD News Article 26123


Return to BSD News archive

Xref: sserve comp.unix.programmer:14376 comp.unix.bsd:13277
Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!think.com!spdcc!ora.com!minya!jc
From: jc@minya.UUCP (John Chambers)
Newsgroups: comp.unix.programmer,comp.unix.bsd
Subject: Re: Can vread be used with UDP?
Message-ID: <1529@minya.UUCP>
Date: 18 Jan 94 03:54:37 GMT
References: <1523@minya.UUCP> <1994Jan10.130118.22057@noao.edu>
Followup-To: s
Lines: 34

In article <1994Jan10.130118.22057@noao.edu>, rstevens@noao.edu (W. Richard Stevens) writes:
> > The Suns have these  extra  read()  and  write()  calls,  vread()  and
> > vwrite(), which handle multiple messages in a single system call. This
> > is enticing, and looks like the obvious  solution  to  the  throughput
> > limit.  But there's a big gotcha:  The vread() call, while it can read
> > multiple messages, seems to have no provision  for  saying  where  the
> > data came from.  The programs all use recvfrom() now, so they can send
> > a reply.  There seems to be no (documented) version of recvfrom() that
> > can deliver more than one message and also indicate the origins of all
> > the messages.
> 
> I assume you referring to readv() and writev()?  (Older BSD systems did
> indeed have a vread() and vwrite(), but they were totally different beasts.)
> If so, look at recvmsg(2) and sendmsg(2)--they provide the i/o vectors from
> readv/writev with the peer address from recvfrom/sendto (and other stuff).


Yah; I'm on another (Sys/VR4) machine about 8  miles  away,  and  it's
hard to remember all the spellings and incantations exactly ...

The recvmsg man page is there, and I examined it. While it does return
multiple  messages, it seems that they are all catenated together into
one big message, thus losing the message boundaries.  This wouldn't be
too  bad;  the real problem is that there appears to be only one place
for recvmsg to put a source address.  In general, incoming messages in
a  datagram  socket  will  be  from  different source addresses.  This
doesn't seem like it could ever be usable if you wish to send a  reply
back to the client.

What am I missing?

-- 
All opinions Copyright (c) 1994 by John Chambers.  Inquire for licensing at:
1-617-647-1813 ...!{harvard.edu,eddie.mit.edu,ruby.ora.com}!minya!jc