Article View: news.software.nntp
Article #67134Re: Programming/NNTP Questions
From: DS
Date: Mon, 10 Nov 2003 13:46
Date: Mon, 10 Nov 2003 13:46
69 lines
4693 bytes
4693 bytes
"aaronb" <borgaaron@yahoo.com> wrote in news:3faf228c$0$801$c3e8da3@news.astraweb.com: > I have followed your suggestion for timing the responses from the > server and I think I have discovered where the bottleneck really is. I > think it's the process that you described. I believe that it's the way > I'm grabbing the data from the buffer itself and not so much the > processing. I've found quite a few examples of getting data from a > NNTP server in C#, but everyone of them was different and were very > basic in nature. I'm still in the dark about how much data at a time I > should be getting from the socket and putting into the buffer. My > current method is to get 256 bytes at a time, process it form the > /r/n, cut one whole message from the XOVER response out of the buffer, > store it, save the excess buffer and add on to it in the next read... > of all the methods I've tried it seems to be working the best so far. > I'm not a very experienced programmer with windows apps, but I have > been programming one thing or another for the past 20 years. Is there > any advice you could give me on methods to use for interacting with > the socket and buffer to get the data in an easier or more productive > fashion? > > Aaron > Aaron, I can't help you with specific C# code, I'm using VB, but I can explain how I've coded my program. First, I'm not using the VB Winsock control, I have a Winsock class I'm using. The class: 1) Receives data. This fires the data received event. 2) The OnDataReceive event reads the entire buffer, then sends it to a procedure that parses the data packet. 3) In the parsePacket procedure, I do a headers() = Split(data,cr/lf), splitting the data by cr/lf's. Each element in the array is then passed to another procedure, parseHeader(headers(x)), which breaks the header dataset down into the actual NNTP fields and does additional processing such as multi-part detection. Any leftover data from the Split() is stored in a string variable. If at the start of the parsePacket() proc., there is data in the leftover variable, it is added to the beginning of the next packet sent. 4) Add to the database - this is my bottleneck. Since I'm using an Access database structure, I had experimented with many different techniques to get records into it and it is currently at what worked best at the time, but since then I have come up with a couple of other possibilities that I need to try out. It's the bottleneck because I'm d/l XOVER data on 10 download threads simultaneously, and passing all of this data over thread boundaries, and generally maxing out the capabilities of the Jet db engine. 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. While d/l XOVER data from 6 to 8 threads, I get about 100Kbytes d/l throughput while slipstreaming into the database. If, instead of entering into the db, I just write the data to a text file, I get 200-300KBytes d/l throughput from those same 6 to 8 threads. That is how much the db functions slow it down. DS
Technical Details
Message-ID:
<Xns942F59DEF723Aidispcom@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!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!router1.news.adelphia.net!news1.news.adelphia.net.POSTED!not-for-mailReferences:
<3fa1d38d$0$50372$c3e8da3@news.astraweb.com> <Xns94284B9E63709idispcom@24.48.107.53> <3faf228c$0$801$c3e8da3@news.astraweb.com>Show Full Headers
Complete Article Headers
Message-ID: <Xns942F59DEF723Aidispcom@24.48.107.54> Subject: Re: Programming/NNTP Questions Date: Mon, 10 Nov 2003 13:46:44 GMT From: DS <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> References: <3fa1d38d$0$50372$c3e8da3@news.astraweb.com> <Xns94284B9E63709idispcom@24.48.107.53> <3faf228c$0$801$c3e8da3@news.astraweb.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!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!router1.news.adelphia.net!news1.news.adelphia.net.POSTED!not-for-mail Newsgroups: news.software.nntp Organization: Home User-Agent: Xnews/5.04.25 Lines: 69 NNTP-Posting-Host: 68.71.192.103 X-Complaints-To: abuse@adelphia.net X-Trace: news1.news.adelphia.net 1068472004 68.71.192.103 (Mon, NNTP-Posting-Date: Mon, 10 Nov 2003 08:46:44 EST