From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9bdd666589befb0f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!news2.arglkargh.de!news.karotte.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Palatable Windows IO using Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1144369304.698267.277640@u72g2000cwu.googlegroups.com> <15qxrbngb2kll.wkigwit0g1tn.dlg@40tude.net> <1144427423.152451.170970@j33g2000cwa.googlegroups.com> Date: Fri, 7 Apr 2006 20:51:01 +0200 Message-ID: NNTP-Posting-Date: 07 Apr 2006 20:50:59 MEST NNTP-Posting-Host: cda35064.newsread2.arcor-online.net X-Trace: DXC=OSRlj]E``TcGI7?jFVGnfcQ5U85hF6f;djW\KbG]kaMhAV6U:Z=fE=oRDa[O\3Y On 7 Apr 2006 09:30:23 -0700, Le wrote: > Your attempt at a tutorial is in error in a couple of places. Stating > that an application "should know" what will be returned is > presumptuous. Note this is a legacy application, so obviously there are > some devices out there which give varying responses. These are raw byte > sequences - no blocks or lines. If you mean a byte stream, then it is *byte* you (or application) should know of. You cannot read any device not knowing the size of input. You might have a higher level communication protocol which build something out of these bytes, for example, "a valid Ada program encoded in ASCII." But how an OS driver might know about it? > The ReadFile interface *is* blocking. Overlap allows an app to come > back and see if it is done. Then it is rather a strange definition of "blocking." In my world blocking operation means that the execution thread gets blocked until its completes. The thread cannot go anywhere it that state. > With respect to buffering, my point was that doing byte at a time IO to > get around the blocking nature of the API defeats the efficiencies > presumably provided by the driver's internal buffering. How so? Byte-wise reading just does not do any extra and unnecessary buffering, because OS already did it. One could argue that OS API are expensive to call. This a different issue. I don"t have any figures concerning Windows, but in my experience that was never a problem. At least when reading from sockets and serial devices. As for overlapping ReadFile, your argument does not apply either, because it gets *all available* bytes the buffer provided in its argument can take. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de