Using nntplib

jb jblazi at hotmail.com
Fri May 31 06:19:00 EDT 2002


Steve Holden wrote:
> Well I'm not sure why you think nntplib changes would be required. Perhaps
> I didn't explain myself clearly. You were suggesting having a GUI thread
> and a "worker" thread (if I understood you). I was simply saying that the
> worker thread could use XOVER to find out what messages are available, and
> then retrieve them (using the standard nntplib features) and queue them
> for the GUI thread to display. The sample code I referenced shows how,
> with no nntplib changes. Clearly the messages would need to be available
> to other worker threads as well.

Alas! this is not a very good solution (or I basically do not understand, 
what is going on). Let us assume I send a LIST command. Then, if everything 
is in order, the server will send an immediate response: "215 list of 
newsgroups follows". Then I start the other thread and this other thread 
starts waiting for the lines. Possibly I can wake it up avery second to 
look if anything is there. Now let us assume, 50000 lines will follow. 
(Nowadays, if your host is for example 'goliath.newsfeeds.com',  100,000 
lines might follow as well and could be stored locally in main memory.)

Sending and receiving those lines takes some time and even if my user 
interface is still responsive (as I use another thread), still during all 
this time I cannot tell the user of the nntlib call, how many lines have 
arrived already.
This is obviously not acceptable.

Additionally, you would use some GUI (Qt in my case) where you would have a 
main loop. That means, that you end up with doing "multitasking" in two 
very different ways and maybe this is not a very trustworthy solution.

The best possibility seems to me, to rewrite nntplib, so that it fits in 
with Qt and as the NNTP protocol is very simple and nntplib is very clearly 
written, this seems to be simple. Maybe I shall try it.

-- 
Janos Blazi

"Il n'y a guère dans la vie qu'une préoccupation grave: c'est la mort;" 
(Dumas) 



-----------== Posted via Newsfeeds.Com - Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Ulimited Fast Downloads - 19 Servers =-----



More information about the Python-list mailing list