Article View: news.software.nntp
Article #55822Re: Forecasting the posting's size
From: Joshua
Date: Tue, 01 Jan 2002 15:39
Date: Tue, 01 Jan 2002 15:39
40 lines
2991 bytes
2991 bytes
"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 ... > Issue: You do know about dot escaping leading dots don't you? It might > be ok to ignore them like you have done here, assuming you did that because > you knew what you were doing and not because you didn't know about it... I only get and save what the client sends. I know dot escaping format,but I keep them either receiving from clients or send back to clients. > It's most likely the read-a-byte-at-a-time style of code that's making > it slow. You need to allocate a larger buffer, and then read as many > bytes as possible with one read (I don't know C++ so maybe it's also > the RecvRaw() function in general that's too slow also). Then you scan the > bytes you just read to check for a match with the CR LF DOT CR LF. RecvRaw() is a new function I re-write based on ::recv(). I will re-write my code according your advice. Thank you very much!
Technical Details
Message-ID:
<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-01!supernews.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!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>Show Full Headers
Complete Article Headers
Message-ID: <a0sldf$457$1@mail.cn99.com> Subject: Re: Forecasting the posting's size Date: Tue, 1 Jan 2002 23:39:31 +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> 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-01!supernews.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!news.bentium.com!news.cn99.com!not-for-mail Newsgroups: news.software.nntp Organization: Bentium Ltd. (CN99) Lines: 39 NNTP-Posting-Host: 61.156.86.60 X-Trace: mail.cn99.com 1009899759 4263 61.156.86.60 (1 Jan 2002 15:42:39 GMT) X-Complaints-To: usenet@news.cn99.com NNTP-Posting-Date: Tue, 1 Jan 2002 15:42:39 +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