🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
8 messages
8 total messages Started by Tim Mavers Tue, 03 Sep 2002 20:03
Aborting NNTP commands
#60201
Author: Tim Mavers
Date: Tue, 03 Sep 2002 20:03
26 lines
2006 bytes
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).

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)?  Let's 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.  AFAICT, the server is just sending a stream of data.  Is
closing the connection (abruptly during the transfer) a desired approach?

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.

Thanks,



Re: Aborting NNTP commands
#60200
Author: Jeremy
Date: Tue, 03 Sep 2002 20:39
20 lines
1912 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.

There is no provision for this in the protocol.  The only way to "abort"
is to tear down the socket connection, which is less than clean and
polite, but that technique is used by things like Outlook Express (not
that OE should be considered a model for NNTP client behavior).

Most clients just don't implement a "stop" button, since there isn't
any such thing in NNTP.  One significant problem with aborting a
connection like this is that the server may not "know" you've aborted
right away, and if it implements a per-user simultaneous connection
limit, your user may run into it after a couple of aborts because the
server hasn't registered that the previous connections are gone yet.

-- 
Jeremy  |  jeremy@exit109.com
Re: Aborting NNTP commands
#60202
Author: Erik Hensema
Date: Tue, 03 Sep 2002 20:45
24 lines
2429 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).
> 
> 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)?  Let's 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.  AFAICT, the server is just sending a stream of data.  Is
> closing the connection (abruptly during the transfer) a desired approach?

It's the only way. The server should be able to take it.

-- 
Erik Hensema (erik@hensema.net)                             ICQ# 8280101
Quoting-HOWTO: http://www.leerquoten.nl
Re: Aborting NNTP commands
#60203
Author: Curt Welch
Date: Tue, 03 Sep 2002 21:14
76 lines
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/
Re: Aborting NNTP commands
#60204
Author: Kjetil Torgrim Homme
Date: Tue, 03 Sep 2002 22:10
23 lines
1825 bytes
[Curt Welch]:
>
>   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.

it might be an idea to issue

  LIST ACTIVE a*
  LIST ACTIVE b*
  :
  LIST ACTIVE z*
  LIST ACTIVE [^a-z]*

some of the letters, notably a, will have a lot more data than others.
(not sure if all servers accept "LIST ACTIVE wildmat", but if you get
an error, just fall back to plain "LIST").

-- 
Kjetil T.   ==. ,,==. ,,==. ,,==. ,,==. ,,==
           ::://:::://:::://:::://:::://::::
           =='' `=='' `=='' `=='' `=='' `==  http://folding.stanford.edu
Re: Aborting NNTP commands
#60267
Author: Russ Allbery
Date: Fri, 06 Sep 2002 16:19
20 lines
1894 bytes
Curt Welch <curt@kcwc.com> writes:

> I for one never knew it existed.  Is it a standard?  I have seen
> reference to "authinfo simple" and wondered what it was but never knew
> it was a one-line version of the authinfo command.  It doesn't work on
> my service so that's why it's not used here. :)

There isn't any real standard for any of the AUTHINFO stuff, and for
whatever reason most news readers and implementations converged on the
separate username and password commands.

Neither AUTHINFO SIMPLE nor AUTHINFO GENERIC are really used by anyone
much.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Aborting NNTP commands
#60293
Author: Kai Henningsen
Date: Sun, 08 Sep 2002 10:10
26 lines
2247 bytes
rra@stanford.edu (Russ Allbery)  wrote on 06.09.02 in <yl65xj9jlt.fsf@windlord.stanford.edu>:

> Curt Welch <curt@kcwc.com> writes:
>
> > I for one never knew it existed.  Is it a standard?  I have seen
> > reference to "authinfo simple" and wondered what it was but never knew
> > it was a one-line version of the authinfo command.  It doesn't work on
> > my service so that's why it's not used here. :)
>
> There isn't any real standard for any of the AUTHINFO stuff, and for
> whatever reason most news readers and implementations converged on the
> separate username and password commands.
>
> Neither AUTHINFO SIMPLE nor AUTHINFO GENERIC are really used by anyone
> much.

There really should be a variant which uses SASL. Do the new NNTP drafts  
have something for that, or is it still in the "would be nice but nobody  
has done the legwork" stage?

Kai
-- 
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)
Re: Aborting NNTP commands
#60295
Author: Russ Allbery
Date: Sun, 08 Sep 2002 16:15
27 lines
2175 bytes
Kai Henningsen <kaih=8WVvo4sHw-B@khms.westfalen.de> writes:
> rra@stanford.edu (Russ Allbery) wrote:

>> There isn't any real standard for any of the AUTHINFO stuff, and for
>> whatever reason most news readers and implementations converged on the
>> separate username and password commands.

>> Neither AUTHINFO SIMPLE nor AUTHINFO GENERIC are really used by anyone
>> much.

> There really should be a variant which uses SASL.

Yup, someone's working on it (I'll let him speak up here if he wants to
provide more details).

> Do the new NNTP drafts have something for that, or is it still in the
> "would be nice but nobody has done the legwork" stage?

Neither; a lot of the legwork has been done, but it's out of scope for the
first round of NNTP revisions.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads