Article View: borland.public.cppbuilder.internet.socket
Article #1984Re: help with Indy Telnet
From: Remy Lebeau (TeamB)
Date: Fri, 01 Sep 2006 07:58
Date: Fri, 01 Sep 2006 07:58
50 lines
3181 bytes
3181 bytes
"Andre' Burke" <no.spam@spam.no> wrote in message news:44f7d1ac$1@newsgroups.borland.com... > I can then see it going into the MyDisconnect function and calling > the disconnect. I write a log message right before and directly after > the actual diconnect call and the log file shows the one before it > and nothing after that. In order for that to happen, the TIdTelnet's internal reading thread would have to be deadlocked. Under normal situations, disconnecting the socket would terminate the thread immediately, but if the thread is blocked then it would not be able to detect the socket being closed, which would in turn block Disconnect() because it waits for the thread to terminate before then exiting. > In fact I have added another timer to the form that simply fires once > a second and writes the state of the original timer to the log file, eg > whether it is enabled or not. > Even this extra timer stops at this point. Sounds like you are deadlocking the main thread as well, since TTimer is a message-based timer. If you are calling Disconnect() in the context of the main thread, as the internal reading thread is blocked so that it cannot terminate itself, then Disconnect() is going to be blocked, and thus prevent the main thread from processing pending messages. > I originally had a similar problem when I tried to disconnect from > inside the OnDataAvailable event. You cannot do that. That is a guaranteed deadlock, since Disconnect() would be waiting on the thread to terminate, but the thread would be waiting for Disconnect() to exit. > This seems to be something similar, except that the disconnect > is now no longer being called in the OnDataAvailable method > but rather in the timer. That does not negate the possibility of the reading thread still becoming deadlocked. > It seems as if the Telnet component recieves the incoming data, but > for some reason gets stuck and doesnt call the OnDataAvailable > method. That cannot happen. What is more likely the case is that the OnDataAvailable event handler is becoming deadlocked. Gambit
Technical Details
Message-ID:
<44f7e8a0$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<44f68cef@newsgroups.borland.com> <44f6917c$1@newsgroups.borland.com> <44f69c27@newsgroups.borland.com> <adsdf2dk8k4s0tefv5r49fi67ghjs6rlmt@4ax.com> <44f7d1ac$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3d66693bd859a203 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <44f68cef@newsgroups.borland.com> <44f6917c$1@newsgroups.borland.com> <44f69c27@newsgroups.borland.com> <adsdf2dk8k4s0tefv5r49fi67ghjs6rlmt@4ax.com> <44f7d1ac$1@newsgroups.borland.com> Subject: Re: help with Indy Telnet Date: Fri, 1 Sep 2006 00:58:52 -0700 Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <44f7e8a0$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1157097632 68.69.17.41 (1 Sep 2006 01:00:32 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail