Article View: news.software.nntp
Article #55823Re: Forecasting the posting's size
From: Joshua
Date: Tue, 01 Jan 2002 16:52
Date: Tue, 01 Jan 2002 16:52
44 lines
2805 bytes
2805 bytes
"Joshua" <JoshuaIIII@hotmail.com> wrote in message
news:a0sldf$457$1@mail.cn99.com...
> "Curt Welch" <curt@kcwc.com> wrote in message
> news:20011230215952.153$nt@newsreader.com...
> > "Joshua" <JoshuaIIII@hotmail.com> wrote:
> > > "Curt Welch" <curt@kcwc.com> wrote in message
> > > news:20011230161737.549$XI@newsreader.com...
>
> > > // Read input stream until last char of strStopper matches
> > > recved_len=RecvRaw(pInChar,1,0);
> >
> > Reading a byte at a time from a stream is normally too slow for good
> > performance. You will need to move the data in larger chunks to
> > make it fast (but fast of course is relative idea). byte-at-a-time
might
> > be fast enough for you needs.
>
> In fact I know I can read a block of data from the input stream at a time
> (as large as 16K),but I can't find a way to determine where to terminate
the
> input data. You said that POST data will contain nulls,but I never find
> them. Must I search the *whole* input data string for <CRLF>.<CRLF> as the
> terminator? I think ...after all,it is a little bit unsuitable ...
I change my code into:
received_len=RecvRaw(strBuf+received_total,len-received_total,0);
if (0==received_len)
return 0; //Error
received_total+=received_len;
I have a question here.Is there any possibility that "0==received_len"
happens under heaven? I have test and found if the input stream is empty,
recv() just waits there for inputing. I guess maybe 0==received_len will
never occurs. If so, I think I can re-write the above code into:
received_total+=RecvRaw(strBuf+received_total,len-received_total,0);
Technical Details
Message-ID:
<a0sp1o$8od$1@mail.cn99.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!news.bentium.com!news.cn99.com!not-for-mailReferences:
<a0mi6f$qqr$1@mail.cn99.com> <20011230161737.549$XI@newsreader.com> <a0o95h$or9$1@mail.cn99.com> <20011230215952.153$nt@newsreader.com> <a0sldf$457$1@mail.cn99.com>Show Full Headers
Complete Article Headers
Message-ID: <a0sp1o$8od$1@mail.cn99.com> Subject: Re: Forecasting the posting's size Date: Wed, 2 Jan 2002 00:52:04 +0800 From: "Joshua" <JoshuaIIII@hotmail.com> References: <a0mi6f$qqr$1@mail.cn99.com> <20011230161737.549$XI@newsreader.com> <a0o95h$or9$1@mail.cn99.com> <20011230215952.153$nt@newsreader.com> <a0sldf$457$1@mail.cn99.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!news.bentium.com!news.cn99.com!not-for-mail Newsgroups: news.software.nntp Organization: Bentium Ltd. (CN99) Lines: 43 NNTP-Posting-Host: 61.156.86.60 X-Trace: mail.cn99.com 1009903480 8973 61.156.86.60 (1 Jan 2002 16:44:40 GMT) X-Complaints-To: usenet@news.cn99.com NNTP-Posting-Date: Tue, 1 Jan 2002 16:44:40 +0000 (UTC) X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200