Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: Newsserver disconnects - how to notice this

www.cryer.info
Managed Newsgroup Archive

Re: Newsserver disconnects - how to notice this

Subject:Re: Newsserver disconnects - how to notice this
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 2 May 2006 11:28:56

"Shiva" <shiva@gonzo.com> wrote in message
news:4457a0ba$1@newsgroups.borland.com...

> I've used a TIdTCPServer component to achieve this and everything works
fine

Any reason why you are not using TIdNNTPServer instead?  Or even
TIdMappedPortTCP?

> when the newsserver decides to disconnect after being idle for a couple
> of minutes (the response is: "400 text.nova.planet.nl: Idle timeout." and
> then it disconnects). The disconnection cannot be noticed by OE, because
> it is connected to my program, not to the newsserver.

So, you simply send the 400 reply to OE and disconnect from OE when your
program receives it from the server.  What exactly are you having a problem
with?

> Unfortunately, I am not able to trigger an event once the server
> disconnects (anyway, I don't know how to do that!).

Since you are using TIdTCPServer, you are in full control of the connection
with the server.  Even though the connection with the server is
disconnected, you still have the data that the server sent before
disconnecting, and you still have the connection to OE.  So why can't you
forward the data to OE?

> OE does not notice the disconnection

You are not sending anything to OE when your thread's Disconnect() method is
called, and your are not checking the server for pending data to send to OE
in between commands.

> So the question is: how can I pass the disconnection to OE?

Where EXACTLY are you having the problem?  Please provide SPECIFIC details
about what you are trying to do, the steps the reproduce the problem, etc.

>     if      (Pos('215', ResponseNewsserverISP) = 1)
>          or (Pos('220', ResponseNewsserverISP) = 1)
>          or (Pos('221', ResponseNewsserverISP) = 1)
>          or (Pos('222', ResponseNewsserverISP) = 1)
>          or (Pos('223', ResponseNewsserverISP) = 1)
>          or (Pos('224', ResponseNewsserverISP) = 1)
>          or (Pos('231', ResponseNewsserverISP) = 1)
>          or (Pos('282', ResponseNewsserverISP) = 1) then begin

That is not the correct way to handle multi-line responses, not even close.
You need to look for a '-' character following the 3-digit response number
instead, ie:

    repeat
        ResponseNewsserverISP := NewsserverISP.ReadLn;
        LogMessage('Response ISP=' + ResponseNewsserverISP);
        ClientConn.WriteLn(ResponseNewsserverISP);
    until Copy(ResponseNewsserverISP, 4, 1) <> '-';


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive