Article View: news.software.nntp
Article #67143Re: Programming/NNTP Questions
From: Aaron Borg
Date: Tue, 11 Nov 2003 02:03
Date: Tue, 11 Nov 2003 02:03
140 lines
7877 bytes
7877 bytes
I think I see what you are doing now. You are using a class that someone else built that uses a control that someone else built... so all the workings under the hood are really hidden from you. I'm using C# for this project. It's my first C# app. I'm used to using VB.NET. I imagine that under the hood somewhere you are using a default buffer size for each read from the socket. I have the ability to alter that buffer size. Here are the methods that I have tried: 1. Receive all the data from the socket till there isn't anymore to get. Throw it all into one big string every time the buffer gets full, and then put it in an array splitting it up by the /r/n's. Then I make another array for each header breaking them up by the \t's. This works fine, but there is nothing on the screen till the entire reading process in complete. Nothing on the screen for a few minutes (or longer if you are downloading 800,000+ headers). 2. Send a new HEAD request for every header I want. Terribly slow. Most of the examples I looked at worked this way. 3. Use XOVER and read X bytes from the stream, check for a /r/n, if found, cut out and parse one header. if not found, read from the stream again till I do find the /r/n. This is the method that I am using now and it seems to work fine... I parse each header as I receive it and make DataTables inside a DataSet. I make a new DataTable for each Message and store each header that corresponds to it inside that table. Then when I want to download a file, all the posts that contain data for the one multi-part encoded file are all located in the one table and I then have to download and decode them. I've been trying to figure out how the other commercial readers read from the socket and parse the data so quickly... I'm not accessing the hard drive at all in my process, its all stored in ram, but its still nowhere as fast as these other products. Guess I'll just have to hack away at it till I figure something out. "DS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message news:Xns942FB0A468A4Cidispcom@24.48.107.54... > "aaronb" <borgaaron@yahoo.com> wrote in > news:3fafdbf0$0$15854$c3e8da3@news.astraweb.com: > > > What you are doing sounds similar to what I'm doing... I suppose. I > > don't understand what you are defining as a packet... doesn't the > > server send you all the data you've requested in one long stream? > > Isn't it up to us as the programmer to decide where to break off > > receiving data and process it? I've tried using anything from 1 byte > > at a time up to 4-8k bytes in one read.... but I have yet to find a > > sweet spot that I'm satisfied with. > > I'm not sure who's responsibility it is. I probably shouldn't have used > the word packet, since that isn't really what I'm doing. What I meant was > actually 'data'. The data in the receive buffer when the OnDataReceive > event notifies me there is data waiting. Like I said, I'm using a Winsock > class in VB. The class fires the event OnDataReceive according to > whatever is set up in the registry for winsock buffers. I just looked > through the class and didn't see any settings for the buffer size. > > > > > Yes, data does build up when I use a 256 byte buffer... I started out > > using a 32 byte buffer so that I didn't have much if anything left > > over after receiving one complete header but I found that I shaved off > > some processing time when moving up to 256. > > > > I start off by creating a TCPClient and connect to the server, send my > > commands, process the first 3 bytes received so I can know what > > response code was given and treat it accordingly. When I know that the > > XOVER data will be coming, I switch over to the 256byte buffer and > > loop till done. > > See, here's where I'm not to sure about what to tell you. With the > Winsock class I have, when I send an XOVER xxxxx- command, I get an > OnDataReceive event. I retreive the data and it only contains the '224 > Data to Follow' string. Then, when the OnDataReceive event fires again, > it is the start of the XOVER datastream. With slow servers, the class' > buffer doesn't even fill up most of the time, even while still receiving > the stream. There could be some type of timeout built in to it such that > if the connection is still valid and x amount of time has passed since > data was received, fire the event. > > The class I'm using is here: > http://www.vbip.com/winsock-api/csocket-class/csocket-class-01.asp > > > > > I guess what I'm looking for is other conceptual methods of > > interacting with the incoming stream that will increase the speed of > > the program. I've timed Outlook express, Newsbin and Xnews and they > > are all very similar in speed, but my process is anywhere from 2-5 > > times slower. I had not thought of sending multiple XOVER commands to > > receive the data in multiple streams. That does sound like a great > > idea. > > > > I must ask, and should have asked earlier, what language you are using, > and what kind of PC ? The way I'm doing it is fairly CPU intensive. I'm > developing on a 1GHz CPU w/512 Megs of RAM. When I did a test install on > a K6-2 500 MHz, it was only going half the speed. You did mention C# in > one of your other posts, if so, the class above won't do you any good, > sorry. The multiple datastreams I'm utilizing for XOVER is 1 connection > per server per group. So I could be XOVER'g from 4 different groups, on 3 > different servers, for a total of 12 streams. Not a very easy thing to > accomplish in VB6. > > Have you tried setting your buffer to a high number, like 1 MBytes, or > 256KBytes ? > > Regards, > > DS > > > > > > "DS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message > > news:Xns942F59DEF723Aidispcom@24.48.107.54... > >> "aaronb" <borgaaron@yahoo.com> wrote in > >> news:3faf228c$0$801$c3e8da3@news.astraweb.com: > >> So in response to the rx buffer size, I never messed with any of > >> those settings. On a fast server, incoming data can be 4096K, on > >> slower servers sometimes it's only a few hundred bytes. The only > >> leftover data I'm > > storing > >> is incomplete header info. I end up processing all of the received > >> data before I accept another packet. Depending on you're server's > >> speed, and > > the > >> fact that you're only taking 256 bytes at a time, I can see the > >> 'leftover' buffer growing to be huge at somepoint, depending on the > >> additional processing you're doing. > >> > >> > >> DS > >> > > > > >
Technical Details
Message-ID:
<3fb03870$1_5@news.buzzardnews.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.20140818.mbox.gz!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!feeder.buzzardnews.com!news.buzzardnews.com!not-for-mailReferences:
<3fa1d38d$0$50372$c3e8da3@news.astraweb.com> <Xns94284B9E63709idispcom@24.48.107.53> <3faf228c$0$801$c3e8da3@news.astraweb.com> <Xns942F59DEF723Aidispcom@24.48.107.54> <3fafdbf0$0$15854$c3e8da3@news.astraweb.com> <Xns942FB0A468A4Cidispcom@24.48.107.54>Show Full Headers
Complete Article Headers
Message-ID: <3fb03870$1_5@news.buzzardnews.com> Subject: Re: Programming/NNTP Questions Date: Mon, 10 Nov 2003 18:03:13 -0800 From: "Aaron Borg" <aborg@paml.com> References: <3fa1d38d$0$50372$c3e8da3@news.astraweb.com> <Xns94284B9E63709idispcom@24.48.107.53> <3faf228c$0$801$c3e8da3@news.astraweb.com> <Xns942F59DEF723Aidispcom@24.48.107.54> <3fafdbf0$0$15854$c3e8da3@news.astraweb.com> <Xns942FB0A468A4Cidispcom@24.48.107.54> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!internal1.nntp.ash.giganews.com!border2.nntp.ash.giganews.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed.news2me.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!feeder.buzzardnews.com!news.buzzardnews.com!not-for-mail Newsgroups: news.software.nntp Lines: 140 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: news.buzzardnews.com X-Authenticated-User: aborg