Date: Sun, 17 Nov 1996 10:58:57 PST From: Bill Fenner <fenner@parc.xerox.com> To: "Marc G. Fournier" <scrappy@ki.net> Cc: hackers@freebsd.org Subject: Re: Advise needed (readv()/writev()) Message-ID: <96Nov17.105859pst.177557@crevenia.parc.xerox.com> In-Reply-To: Your message of "Sun, 17 Nov 96 09:30:49 PST." <Pine.NEB.3.95.961117121157.18169B-100000@quagmire.ki.net>
next in thread | previous in thread | raw e-mail | index | archive | help
When writev returns -1, use perror to find out why. readv will not do multiple reads; its behavior is exactly like read except that it will do scatter/gather I/O into your buffers. If you really really really want to do this, use recvmsg() on the socket and set flag MSG_WAITALL. This is not portable to non-4.4BSD machines, so you might do better just doing a looping read(). If you don't know how big the pages are in advance, you need to use a fixed-length header that says how big the following data is. For an example of such a protocol, see ftp://ds.internic.net/internet-drafts/ draft-odell-sfrp-00.txt . Bill
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96Nov17.105859pst.177557>