Thread View: news.software.nntp
14 messages
14 total messages
Started by Darrell Davis
Sat, 24 Mar 2001 00:39
NNTP Commands Question
Author: Darrell Davis
Date: Sat, 24 Mar 2001 00:39
Date: Sat, 24 Mar 2001 00:39
26 lines
2087 bytes
2087 bytes
I am working on a utility to poll a NNTP server for messages and keep them in a local database. Mainly this is a programming exercise. The server I am developing against is DNews, but I want it to be generic enough to work on most NNTP servers. I believe I should use the "newnews yymmdd hhmmss GMT" command. I believe that I should also use the "date" command to get the exact time on the server to account for time difference between the polling computer and the server. Is this correct? Sort of like this: 1) Issue "date" command and save result in D. 2) Issue "newnews" command passing date and time of last poll. 3) Save D as date and time of last poll, to be used the next time I poll. Is this the correct process? Also, I don't completely understand MessageID. These are the numbers that newsreaders use to remember which messages the user has read, correct. Stored in the .newsrc file, correct? Do these numbers ever get reset, or do they just keep increasing indefinately. It seems to me I am missing something. Thanks for any pointers. Darrell Davis
Re: NNTP Commands Question
Author: Andrew Gierth
Date: Sat, 24 Mar 2001 02:25
Date: Sat, 24 Mar 2001 02:25
52 lines
3428 bytes
3428 bytes
>>>>> "Darrell" == Darrell Davis <darrell.davis@usa.net> writes: Darrell> I am working on a utility to poll a NNTP server for messages Darrell> and keep them in a local database. Mainly this is a Darrell> programming exercise. The server I am developing against is Darrell> DNews, but I want it to be generic enough to work on most Darrell> NNTP servers. I believe I should use the "newnews yymmdd Darrell> hhmmss GMT" command. I believe that I should also use the Darrell> "date" command to get the exact time on the server to Darrell> account for time difference between the polling computer and Darrell> the server. Is this correct? Sort of like this: Darrell> 1) Issue "date" command and save result in D. Darrell> 2) Issue "newnews" command passing date and time of last poll. Darrell> 3) Save D as date and time of last poll, to be used the next Darrell> time I poll. Ideally you should subtract a few minutes of fuzz from the time of last poll, and make sure you ignore any duplicates. However, there are still a lot of servers that have the NEWNEWS command administratively disabled, because on older INN servers and Typhoon the performance stank, loading the server down a lot when one client did a NEWNEWS command. The more widely useful method is to keep track of article numbers read for each group, and compare those with the result of GROUP or LIST ACTIVE to work out which new articles to download. Darrell> Also, I don't completely understand MessageID. These are Darrell> the numbers that newsreaders use to remember which messages Darrell> the user has read, correct. No. The message-id (the <wqiueyqiuwuey@somedomain.example> bit) is a (supposedly) globally-unique identifier for each message. Newsreaders generally use the article number instead, which is server-specific (the same article on different servers has the same message-id but different article numbers). Darrell> Stored in the .newsrc file, correct? Do these numbers ever Darrell> get reset, or do they just keep increasing indefinately. Article numbers increase indefinitely until they reach 2^32, then the Death of Usenet occurs, unless the server has been scrapped in the meantime and all the article numbers reset. (Takes about 50-100 years to reach that point even with a high-volume pseudo-group like control.cancel.) -- Andrew.
Re: NNTP Commands Question
Author: Darrell Davis
Date: Sat, 24 Mar 2001 03:32
Date: Sat, 24 Mar 2001 03:32
26 lines
2021 bytes
2021 bytes
Thanks for the responses. They are a big help. Few more questions. > The more widely useful method is to keep track of article numbers read > for each group, and compare those with the result of GROUP or LIST ACTIVE > to work out which new articles to download. Thanks. I will use this method. It occurs to me that by doing this I would need to keep a permanent list of message ids ever received (not just what I currently have in my database) plus I would be reexamining many more message ids each day than would actually be new to my system. > No. The message-id (the <wqiueyqiuwuey@somedomain.example> bit) is a > (supposedly) globally-unique identifier for each message. > > Newsreaders generally use the article number instead, which is > server-specific (the same article on different servers has the same > message-id but different article numbers). Sorry, I mispoke. I guess I meant the article number. Thanks for clarifying that. Darrell
Re: NNTP Commands Question
Author: Andrew Gierth
Date: Sat, 24 Mar 2001 03:48
Date: Sat, 24 Mar 2001 03:48
28 lines
2276 bytes
2276 bytes
>>>>> "Darrell" == Darrell Davis <darrell.davis@usa.net> writes: > Thanks for the responses. They are a big help. Few more questions. >> The more widely useful method is to keep track of article numbers >> read for each group, and compare those with the result of GROUP or >> LIST ACTIVE to work out which new articles to download. Darrell> Thanks. I will use this method. It occurs to me that by Darrell> doing this I would need to keep a permanent list of message Darrell> ids ever received (not just what I currently have in my Darrell> database) plus I would be reexamining many more message ids Darrell> each day than would actually be new to my system. why? Assuming you really mean "article numbers" rather than message-ids, most of the time you would simply record the highest article number received so far. (You need to refine this slightly if you are dealing with servers that can create article numbers out of order, i.e. where article, say, 1001 may exist and be available before article 1000. Most large server clusters exhibit this behaviour, though it may only be noticable if you check a specific group at very frequent intervals.) -- Andrew.
Re: NNTP Commands Question
Author: Darrell Davis
Date: Sun, 25 Mar 2001 23:55
Date: Sun, 25 Mar 2001 23:55
41 lines
3005 bytes
3005 bytes
Actually no, this time I did mean message-ids. This is getting confusing. Should I use article number instead? Keep track of the highest contiguous article number received? So if I receive article number 99 and 101, keep 99 as my high water mark. So a server should never reuse article numbers correct? RFC 977 doesn't say anything about how servers keep track of article numbers. That's my only reference so far. Darrell "Andrew Gierth" <andrew@erlenstar.demon.co.uk> wrote in message news:87g0g3ltdw.fsf@erlenstar.demon.co.uk... > >>>>> "Darrell" == Darrell Davis <darrell.davis@usa.net> writes: > > > Thanks for the responses. They are a big help. Few more questions. > >> The more widely useful method is to keep track of article numbers > >> read for each group, and compare those with the result of GROUP or > >> LIST ACTIVE to work out which new articles to download. > > Darrell> Thanks. I will use this method. It occurs to me that by > Darrell> doing this I would need to keep a permanent list of message > Darrell> ids ever received (not just what I currently have in my > Darrell> database) plus I would be reexamining many more message ids > Darrell> each day than would actually be new to my system. > > why? > > Assuming you really mean "article numbers" rather than message-ids, > most of the time you would simply record the highest article number > received so far. > > (You need to refine this slightly if you are dealing with servers that > can create article numbers out of order, i.e. where article, say, 1001 > may exist and be available before article 1000. Most large server > clusters exhibit this behaviour, though it may only be noticable if > you check a specific group at very frequent intervals.) > > -- > Andrew.
Re: NNTP Commands Question
Author: J.B. Moreno
Date: Mon, 26 Mar 2001 06:31
Date: Mon, 26 Mar 2001 06:31
23 lines
2053 bytes
2053 bytes
In article <3abe8721$1@carrock.netin.com>, Darrell Davis <darrell.davis@usa.net> wrote: > Actually no, this time I did mean message-ids. This is getting confusing. > Should I use article number instead? Keep track of the highest contiguous > article number received? So if I receive article number 99 and 101, keep 99 > as my high water mark. So a server should never reuse article numbers > correct? RFC 977 doesn't say anything about how servers keep track of > article numbers. That's my only reference so far. Yes, you should use article numbers not message-id's, yes, the article numbers are supposed to just keep increasing (at least until 2^32 at which point it is supposed to wrap around). This was discussed not to long ago, in the thread starting with message <36916.96891amb@40tude.com> (you can find that on Google at: <http://groups.google.com/groups?q=msgid:%3c36916.96891amb@40tude.com%3e &ic=1>), if you're interested in the possible failures and what to do about them, check it out. -- J.B. Moreno
Re: NNTP Commands Question
Author: Curt Welch
Date: Mon, 26 Mar 2001 06:44
Date: Mon, 26 Mar 2001 06:44
154 lines
9215 bytes
9215 bytes
"Darrell Davis" <darrell.davis@usa.net> wrote: > Actually no, this time I did mean message-ids. This is getting > confusing. Should I use article number instead? Yes. > Keep track of the > highest contiguous article number received? Yes. Bascially. > So if I receive article > number 99 and 101, keep 99 as my high water mark. Not exactly. > So a server should > never reuse article numbers correct? Bascially. But not exactly. > RFC 977 doesn't say anything about > how servers keep track of article numbers. That's my only reference so > far. None of the references give you the real-world experience you need to write it correctly. But I'll give you a free lesson because I haven't answered many questions like this in some time so I guess it's my turn. :) To start with, yes you should use article numbers to figure out which articles you have read/downloaded and which ones you haven't read. When servers receive a new article for a group, it gets assigned the next highest article number. The article numbers just keep couting up higher and higher. Article numbers are 32 bit numbers (minus one for the sign bit). So they can count up to 2^31. For real groups, it would take hundreds of years to overflow that counter, so the fact that it keeps counting up isn't a problem. All servers keep their own article numbers. When you install/build a new server, the artile numbers all start at 0 (or 1). But sometimes admins will start the numbers at a different value for some special reason. A server will never reuse an article number. Once an article is assigned a number, that number will never get used again. BUT, if the news server crashes for example, or is replaced with new hardware, it's possible that all the article numbers will start over at 0. Or at some other number the news admin sets. So, it's possible that one day, you look at a group, like news.software.nttp, and the articles may be in the range 10000 to 11220. Then the next day, you check the server, and find the articles are now numbered 1 to 56 for some unknown reason. It's important for your software not to think it's highwater mark is 11220 and wait for the articles to count back up to that point before trying to download new articles again. The NNTP GROUP command will give you the valid range for articles currently in the group -- the current low and high article numbers. In theory, these numbers will never go down. Every time you check them, you should see the range the same, or the numbers should be higher (the low number moves up as articles are expired, the high moves up as new articles come in). But you never know what might really happen on some of the larger complex servers. Your software should not blow up just because the high water mark is one less right now than it was 5 minutes ago, or if the low water mark when down. What is safe to assume is that the only articles you should try to read are the ones which fall within the range returned by the GROUP command. And the other thing that's save is that once you read/download article N, you will never need to check for it again to see if it might be a different article. When you try to read articles in the GROUOP range, you will get errors for some of them. The main and "normal" reason this happens is because that either 1) articles were canceled, 2) they expired out of order. Both of these things are normal expected behavior from news servers. And with these erros, it means that once you try to read the article, if the server tells you it's gone, then there's no point in trying again because it really is gone and will never come back. i.e. you missed it and there's nothing you can do about it. If you read articles 99 and 101, but 100 is reported as missing, then you would normally assume it is missing and will never show up. But, with the bug as talked about above, sometimes article show up out of order. This happens because some news servers are actually made up of multiple servers. The articles were assigned numbers in-order as they were received on the first server, but then they are sent to a second server which is using the numbers assigned by the first server. Articles commonly get sent in ways that allow them to show up on the second server out of order. So article 101 may show up before 100. But on a normal working server, this time delay will be seconds at most. And these gaps will only happen for the new articles (near the high water mark). These servers BTW are broken. But they do exist. And if it's important to never mis an article, your software needs to recheck the old gaps. But you don't need to keep re-checking them for days and days. If the gap hasn't been filled withing an hour or so, it's not likely to ever be filled. You have to decide for yourself how you software will deal with that and how much re-checking you feel is justified. If you just trying to download everything from a group, then all you need to do is use the GROUP and ARTICLE commands. Your software will keep track of the highwater mark of what it's downloaded, and maybe a bit more to help it correctly spot article number resets, and to know what missing articles from last time may need to be checked for again on this pass. But, if you want to select articles to download, (or to not download) based on things like subject or author, then you might start using XOVER. And there are issues there. XOVER returns the data from some of the most commonly used headers. And if the command is working correctly, will correctly report which articles are avalable and which are missing - and that should be consistent with what happens when you try to fetch the article with the ARTICLE command. But on all to many servers, it's not. It's all too common for broken servers to return XOVER data for articles which were long ago deleted. And some servers that aren't configued correctly may not return XOVER data for articles even though they are still available on the server. Just be aware of these issues when you write your code and don't assume everything is perfect. Then there's the time issue. News servers constantly receive new articles and are constly removing articles (in the range of 15 per second for a full feed). The low and high article numbers for a group will be changing as your software is trying to download stuff. So once again, be aware of this and make sure you code doesn't expect it to remain constent. For example, don't do two GROUP commands and expect the numbers to be the same both times. And don't be surprised if you try to read and article and you get a different response code because the article is out of range, (not just missing). It may have been in range when you did the group command 3 ms ago, but it's out of range now. Response codes is another pain in the butt with NNTP programming. There are standards, but none of the servers match any of the RFCs (for all codes). Most are fairly consistent, but there are execeptions. The only way you will find them all is to do a lot of testing on as many different servers as you can. Mostly, the response codes that say something "worked" will be the same, but the error codes will vary more wildly. Just once again, don't expect the server to only return one and only one fixed code. Now, having said all this, if you don't really need to do it all "right", and just want to get a basic suck feed working (which is what we call a client which simply downloads all new articles from groups) for a single server, then all you need to do is use the GROUP and ARTICLE commands, and keep track of the highest article downloaded so far for each group. Don't worry about everything else I've said and it will work fine 99.9% of the time. :) -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Re: NNTP Commands Question
Author: Russ Allbery
Date: Mon, 26 Mar 2001 07:03
Date: Mon, 26 Mar 2001 07:03
16 lines
1794 bytes
1794 bytes
J B Moreno <planb@newsreaders.com> writes:
> Yes, you should use article numbers not message-id's, yes, the article
> numbers are supposed to just keep increasing (at least until 2^32 at
> which point it is supposed to wrap around).
Actually, it's a violation of the protocol to some degree to wrap the
numbers. The protocol sort of assumes that you never have more than 2^32
articles over the life of the server.
--
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: NNTP Commands Question
Author: J.B. Moreno
Date: Tue, 27 Mar 2001 04:46
Date: Tue, 27 Mar 2001 04:46
21 lines
1903 bytes
1903 bytes
In article <yl3dc1rp0a.fsf@windlord.stanford.edu>, Russ Allbery <rra@stanford.edu> wrote: > J B Moreno <planb@newsreaders.com> writes: > > > Yes, you should use article numbers not message-id's, yes, the article > > numbers are supposed to just keep increasing (at least until 2^32 at > > which point it is supposed to wrap around). > > Actually, it's a violation of the protocol to some degree to wrap the > numbers. The protocol sort of assumes that you never have more than 2^32 > articles over the life of the server. That's not really a problem, but the similar looking problem of the server resetting the numbers (or shutting down and restarting) does occasionally happen and he might want to account for it one way or another. -- J.B. Moreno
Re: NNTP Commands Question
Author: Greg Andrews
Date: Wed, 28 Mar 2001 00:55
Date: Wed, 28 Mar 2001 00:55
33 lines
2436 bytes
2436 bytes
"J.B. Moreno" <planb@newsreaders.com> writes: >In article <yl3dc1rp0a.fsf@windlord.stanford.edu>, > Russ Allbery <rra@stanford.edu> wrote: > >> J B Moreno <planb@newsreaders.com> writes: >> >> > Yes, you should use article numbers not message-id's, yes, the article >> > numbers are supposed to just keep increasing (at least until 2^32 at >> > which point it is supposed to wrap around). >> >> Actually, it's a violation of the protocol to some degree to wrap the >> numbers. The protocol sort of assumes that you never have more than 2^32 >> articles over the life of the server. > >That's not really a problem, but the similar looking problem of the >server resetting the numbers (or shutting down and restarting) does >occasionally happen and he might want to account for it one way or >another. > Yes, however, IMO, the "account for it" can be to merely notice that the newest article in the group has a lower number than the last article seen, and give the user a meaningful error message. Ask the user what to do about it. Perhaps even make a guess about what happened on the server, if the articles seem to be starting over from number 1. -Greg -- +++++ Greg Andrews +++ gerg@panix.com +++++ I have a map of the United States that's actual size -- Steven Wright
Re: NNTP Commands Question
Author: J.B. Moreno
Date: Wed, 28 Mar 2001 15:30
Date: Wed, 28 Mar 2001 15:30
21 lines
1828 bytes
1828 bytes
In article <99rcqc$gmc$3@news.panix.com>, Greg Andrews <gerg@panix.com> wrote: > "J.B. Moreno" <planb@newsreaders.com> writes: -snip- > >That's not really a problem, but the similar looking problem of the > >server resetting the numbers (or shutting down and restarting) does > >occasionally happen and he might want to account for it one way or > >another. > > > > Yes, however, IMO, the "account for it" can be to merely notice > that the newest article in the group has a lower number than the > last article seen, and give the user a meaningful error message. Sure, I said "might". It's rare enough that even ignoring it totally would probably be fine in his situation. -- J.B. Moreno
Re: NNTP Commands Question
Author: bill davidsen
Date: Wed, 28 Mar 2001 15:31
Date: Wed, 28 Mar 2001 15:31
31 lines
2532 bytes
2532 bytes
In article <878zlvnbse.fsf@erlenstar.demon.co.uk>, Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote: | Ideally you should subtract a few minutes of fuzz from the time of last | poll, and make sure you ignore any duplicates. | | However, there are still a lot of servers that have the NEWNEWS command | administratively disabled, because on older INN servers and Typhoon the | performance stank, loading the server down a lot when one client did a | NEWNEWS command. | | The more widely useful method is to keep track of article numbers read | for each group, and compare those with the result of GROUP or LIST ACTIVE | to work out which new articles to download. Much better, since some of us have to allow NEWNEWS for administrative reasons, but have the option to reduce the priority of processes which do it. You may find that some sites set your priority lower than whale droppings, and it doesn't (AFAIK) get set back up after the command is run, so performance can become pretty grim on those servers. Of course you can use a canned software like suckfeed as the base for all this if you want. -- bill davidsen <davidsen@tmr.com> CTO, TMR Associates, Inc At LinuxExpo Sun was showing Linux applications running on Solaris. They don't get it, the arrow points the other way. There's a reason why there's no SolarisExpo, Solaris is a tool; Linux is a philosophy, a religion, a way of life, and only incidentally an operating system.
Re: NNTP Commands Question
Author: those who know me have no need o...
Date: Wed, 28 Mar 2001 23:38
Date: Wed, 28 Mar 2001 23:38
24 lines
1817 bytes
1817 bytes
<20010326014442.722$u4@newsreader.com> divulged: >And the other thing that's save is that once you read/download article >N, you will never need to check for it again to see if it might be a >different article. except when the group has been reset, so once you are past that check it becomes safe to make this assumption. >When you try to read articles in the GROUOP range, you will get errors >for some of them. The main and "normal" reason this happens is because >that either 1) articles were canceled, 2) they expired out of order. or created out of order. in which case you should check again, not too often, nor forever. this is often the case when running a cluster with multiple internal feeds. if you want to obtain a list of article numbers that are currently valid (which can change from moment to moment, so act accordingly) you might try a listgroup command first. -- okay, have a sig then
Re: NNTP Commands Question
Author: Carlo Fusco
Date: Mon, 02 Apr 2001 12:54
Date: Mon, 02 Apr 2001 12:54
13 lines
1448 bytes
1448 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote: [cut] > Newsreaders generally use the article number instead, which is > server-specific (the same article on different servers has the same > message-id but different article numbers). Suck and newsx work in the same way. Now, is it wrong to assume that in this way they won't download any control cancel? -- ciao cf
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