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:Sat, 20 May 2006 00:47:43

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

> On a button click I called: IdIRC1.Connect;
> In OnIsOnIRC I called IdIRC.Join('#mychannel'). No result.

Just like in Indy 9, you should be calling Join() after Connect() exits, not
in the IsOnIRC event handler.  IsOnIRC has nothing to do with Connect().

> To track connection status to the IRC server I've added memo
> to the form and on the ircraw event added:

That code is not thread-safe.  The OnRaw event is triggered in the context
of a worker thread.  As such, you must use TThread.Synchronize(), either
directly or via the TIdSync class, in order to access the GUI safely.  This
is also important to do because OnRaw is triggered whenever sending a
command to the server.  The OnRaw event is triggered in the context of the
thread that is sending the command.  So you can have OnRaw event triggering
overlapping each other.  To differentiate this situation, the AContext
parameter of the event handler is nil when sending a command, and non-nil
when receiving data.

> When I run the application it shows the following:
> NICK Danilka
> USER  0 * :
> NOTICE AUTH :*** Looking up your hostname...
>
> And no more info. stucks on "looking up hostname"

That is all occuring on the server end, not insde of TIdIRC.  When TIdIRC
receives the NOTICE command, the OnNotice event is triggered and nothing
else happens until the server finishes its work.

> Adding TIdIOHandlerStream onto the form

That is the completely wrong IOHandler class to use.  That class is designed
to read/write data from TStream objects, not from sockets.  This is useful
for recording and playing log files for debugging and testing.  In order to
communicate with a live server, you need to use TIdIOHandlerStack instead
(which is the default IOHandler class anyway).

> assigning it to TIdIRC object (not setting any properties for
TIdIOHanlderStream)
> makes memo show no raw commands, now I wonder why.

You did not assign a source TStream to the ReceiveStream property which
contains recorded IRC data for TIdIRC to read.

> Then I've tried using TIdIOHandlerStack since it allows connections using
> specified socks info (TIdSocksInfo)  (which is preferrable). Without
setting
> any properties to it, no raw commands shown (no irc connection)  as with
> previous IOHanlder component.

Then you are not using it properly.  What EXACTLY did you do with it?
Please provide more details.

> Then I've added TIdSocksInfo object and assigned it to TIdIOHandlerStack,
> specifed proxy port and host, socks version for a proxy server which
worked
> with other components. Still doesn't work.

Just saying it doesn't work says nothing at all about the actual problem you
are having.  Always provide specific details.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive