Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!uakari.primate.wisc.edu!aplcen!haven!decuac!hussar.dco.dec.com!mjr From: mjr@decuac.dec.com (Marcus J. Ranum) Newsgroups: comp.unix.programmer Subject: when to use readv()/writev() ? Message-ID: <1990Nov8.041357.29013@decuac.dec.com> Date: 8 Nov 90 04:13:57 GMT Sender: news@decuac.dec.com (Network News) Organization: Digital Equipment Corp., Washington Ultrix Resource Center Lines: 20 Originator: mjr@hussar.dco.dec.com What are some cases when I'd want to use readv() instead of read()? I understand the advantages of being able to break things into several buffers (and possibly avoid having to move data around) but does using writev() give me some kind of possible performance improvement? Does writev() help block my data into popular buffer sizes or something like that ? If I have 2 iovecs with 500 and 524 bytes respectively is the operation performed analogous to write(fd,buf,1024) or is it simply write(fd,buf1,500), write(fd,buf2,524) with the kernel just doing the legwork? I see I still have to sum up the sizes of the contents of the scatter/gather arrays so I can check the return of the write - doesn't it get kind of icky when you have a partial writev()? Please let's *NOT* get into a bOring 6-week long discussion about checking return values. Suffice to say I do. :) mjr.