Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: IRC Component and Indy 9

www.cryer.info
Managed Newsgroup Archive

Re: IRC Component and Indy 9

Subject:Re: IRC Component and Indy 9
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Fri, 19 May 2006 10:23:46

"Danila Vershinin" <profyprepATyandexDOTru> wrote in message
news:446df1f3@newsgroups.borland.com...

> Back to Indy 8, TIdTCPClient had TIdSocksInfo

TIdSocksInfo still exists in Indy 9.  But it has been moved.  It is now a
property of the TIdIOHandlerSocket class instead.

> in the code I have the following:
>
> function TXiRC.GetSocksInfo : TSocksInfo;
> begin
>   result := FSocket.SocksInfo;
> end;
>
> In Indy 9 I can not do that.

You need to do something like this now:

    function TXiRC.GetSocksInfo : TIdSocksInfo;
    begin
        Result := nil;
        if Assigned(FSocket) and Assigned(FSocket.Socket) then
            Result := FSocket.Socket.SocksInfo;
    end;

    procedure TXiRC.SetSocksInfo(AValue : TSocksInfo);
    begin
        if Assigned(FSocket) and Assigned(FSocket.Socket) then
            FSocket.Socket.SocksInfo := AValue;
    end;

> I have to: result := FSocket.Socket.SocksInfo; which makes
> Delphi AV when adding the component onto the form.

You are likely not checking for a nil pointer first.  The Socket property is
only valid while a TIdIOHandlerSocket is assigned to the TIdIRC's IOHandler
property.

If you need access to the TIdSocksInfo at design-time, then you will have to
assign your own TIdIOHandlerSocket to the TIdIRC when you create the
instance of it, ie:

    FSocket := TIdIRC(Self);
    FSocket.IOHandler := TIdIOHandlerSocket.Create(FSocket);

> do I have to write "if FSocket.Socket = nil" or smth different?

Yes.

> what happened to InterceptEnabled property in Indy9?

It does not exist anymore.  Intercepts are assigned via the
TIdTCPConnection.Intercept property.  To disable an Intercept, simply assign
nil to that property.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive