From owner-freebsd-hackers Sun Nov 17 10:59:44 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id KAA26513 for hackers-outgoing; Sun, 17 Nov 1996 10:59:44 -0800 (PST) Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id KAA26497 for ; Sun, 17 Nov 1996 10:59:35 -0800 (PST) Received: from crevenia.parc.xerox.com ([13.2.116.11]) by alpha.xerox.com with SMTP id <17140(7)>; Sun, 17 Nov 1996 10:59:03 PST Received: from localhost by crevenia.parc.xerox.com with SMTP id <177557>; Sun, 17 Nov 1996 10:58:59 -0800 To: "Marc G. Fournier" cc: hackers@freebsd.org Subject: Re: Advise needed (readv()/writev()) In-reply-to: Your message of "Sun, 17 Nov 96 09:30:49 PST." Date: Sun, 17 Nov 1996 10:58:57 PST From: Bill Fenner Message-Id: <96Nov17.105859pst.177557@crevenia.parc.xerox.com> Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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