[twsocket] ICS NNTP module question

2005-09-18 Thread Perry Kappetein
Hi everyone...
 
I really like the NNTP module from your package, since Indy10 is failing
with Delphi 2005.
I have 1 thing though, and maybe you can help me.
 
I can't get it to work when I do 
 
nntp.UserName:='perry';
nntp.PassWord:='kappetein;
nntp.Port:='119';
nntp.Host:='nntp1.usenetserver.net';
nntp.Connect;
logfile.Lines.Add(nntp.LastResponse);
Nntp.Authenticate;
logfile.Lines.Add(nntp.LastResponse);
 
 
Since  the nntp.statuscode is not 200 yet.
I thought I create a loop, but then it won't work.
 
like this
 
 
nntp.Connect;
logfile.Lines.Add(nntp.LastResponse);
 
repeat
 //showmessage(inttostr(nntp.StatusCode));
 while not nntp.StatusCode =200 do  logfile.Lines.Add(nntp.LastResponse);

until nntp.StatusCode = 200;
Nntp.Authenticate;
 
This aint working.. but when I use the Showmessage  that I marked then it
will work.  (will get 2x a messagebox coming up though)
how can I make all of this work the right way?
 
Thanks so much
 
   Perry
 
 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] ICS NNTP module question

2005-09-18 Thread Francois PIETTE
 Since  the nntp.statuscode is not 200 yet.
 I thought I create a loop, but then it won't work.

Never create waiting loop, except really needed. Instead, it is much much 
better to simply use the events such as OnSessionConnected, OnRequestDone 
and others. You simply use the event handler to write code to be executed 
when the corresponding event is occuring.

Think asynchronous when you program with ICS. Think a minute how you program 
your GUI (Graphical User Interface): you never wait until the user click on 
a button or menu item. You simple use the OnClick event handler to execute 
the code needed at the time the user click. At a given time, you may write 
on screen Click OK or Cancel. After that, you never (I hope so) write a 
wait loop the wait until the user click on either button. You simply use the 
event handler. So it is exactly the same with ICS component.

For example, at a given time, probably from some Check news button, you 
call connect. Then you simply return from the OnClick event handler while 
the NNTP component try to establish the connection in the background. When 
the connection is established, you have the OnSessionConnected event 
triggered. From there you can request the next operation such as 
authentification.

Got the idea ?

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be



- Original Message - 
From: Perry Kappetein [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Sunday, September 18, 2005 9:02 AM
Subject: [twsocket] ICS NNTP module question


 Hi everyone...

 I really like the NNTP module from your package, since Indy10 is failing
 with Delphi 2005.
 I have 1 thing though, and maybe you can help me.

 I can't get it to work when I do

 nntp.UserName:='perry';
 nntp.PassWord:='kappetein;
 nntp.Port:='119';
 nntp.Host:='nntp1.usenetserver.net';
 nntp.Connect;
 logfile.Lines.Add(nntp.LastResponse);
 Nntp.Authenticate;
 logfile.Lines.Add(nntp.LastResponse);


 Since  the nntp.statuscode is not 200 yet.
 I thought I create a loop, but then it won't work.

 like this


 nntp.Connect;
 logfile.Lines.Add(nntp.LastResponse);

 repeat
 //showmessage(inttostr(nntp.StatusCode));
 while not nntp.StatusCode =200 do  logfile.Lines.Add(nntp.LastResponse);

 until nntp.StatusCode = 200;
 Nntp.Authenticate;

 This aint working.. but when I use the Showmessage  that I marked then it
 will work.  (will get 2x a messagebox coming up though)
 how can I make all of this work the right way?

 Thanks so much

   Perry


 -- 
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://www.elists.org/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be
 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be