Article View: news.software.nntp
Article #60203Re: Aborting NNTP commands
From: Curt Welch
Date: Tue, 03 Sep 2002 21:14
Date: Tue, 03 Sep 2002 21:14
76 lines
4941 bytes
4941 bytes
"Tim Mavers" <webview@hotmail.com> wrote: > I am writing a basic NNTP client in C# (dotnet) and am trying to > determine what is the best way I can abort a (potentially) long NNTP > command. I am only interested in the protocol design itself (rather than > specific C# semanatics). The only way, as others have said, is to close to connection. All servers can deal with that, but, some of them which have set up per-user connection limits may take a few minutes before the closed connection is removed from the per-user count. So you may not be able to open a new connection very quickly all the time. It's also very bad behavior to open and close connections quikly even on ervers that can deal with it well. Some servers have a lot of overhead associated with opening a new connections, authticating, and selecting a group. It's not something you want to do ever 10 seconds. > For example, after I send a "LIST" command to retrieve a list of all > available newsgroups, my client simply keeps reading (through the socket) > lines of data until it receives a "." (or connection is closed). > > This works fine, and I have accomplished a somewhat "abortable" process > by creating a new thread to handle this. However, is there a way to > cancel the actual transmission of text (from the News server)? You close the TCP connection. This tells the server very quickly to stop sending more crap to you. > say > I am on a 28.8k (or slower) connection and getting a list of newsgroups > (> 60,000 on my Giganews server) can take a few mins. What happens if > someone cancels in the middle. Once you close the TCP connection, the next packet to show up gets rejected and packets are sent back to the server to tell it to stop sending. You won't be stuck receiving the entire LIST ACTIVE. But, on a slow connection, there are databuffers which can be full of data and you may end up receiving data for many seconds after the the connection was closed. But it won't be many minutes. > I assume this issue will come up when I start receiving actual messages > too--I am sure encoded binary messages could take some time as well and > may be aborted enroute. Generally, try to design your application so an abort isn't needed very often. One example of a bad design is an application which opens multiple connections, and allows the user to quickly abort an article transfer and start the next transer on another "free" connection. This can work very nicely from the user's perspective on some servers, but a user clicking "next" once a second causing image articles to be partialy downloaded and then aborted once a second is puting an unresonable load on the server. And on the servers which don't reset connection counts quickly, it is likely to fail the re-connects and lock your user out of the system. And example of a good use for the abort is the download of the article list with a LIST ACTIVE. Users should have the option to abort that if they are tired of waiting. Downloading headers can be aborted, but the better way to do that is to downloading them in smaller batches (100 at a time instead 50,000 at once for example), and then allow your application to to stop at the end of the current batch instead of forcing your application to close the connection. Article downloads are ok to abort as well, but just don't make it too fast. Force the user to way 15 seconds for example before you shut down the connection and only abort if the transfer doesn't complete on it's on in that time. Making an interactive application deal well with the limits of a protocol like NNTP over a slow network is hard work. Very few newsreaders do a good job of it. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20020903171416.063$Gp@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!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshosting.com!news-xfer1.atl.newshosting.com!feed1.newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<3d7514d8$0$5514$45beb828@newscene.com>Show Full Headers
Complete Article Headers
Message-ID: <20020903171416.063$Gp@newsreader.com>
Subject: Re: Aborting NNTP commands
Date: Tue, 03 Sep 2002 21:14:16 +0000
From: curt@kcwc.com (Curt Welch)
References: <3d7514d8$0$5514$45beb828@newscene.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!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshosting.com!news-xfer1.atl.newshosting.com!feed1.newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com I.JuiSrbip@I4UawD=ffzgXkFLRrKWi@xW-K5DCF82hujqTW
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
%IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 75