Board index » cppbuilder » Indy 9: EIdTerminateThreadTimeout
Herwig
![]() CBuilder Developer |
Herwig
![]() CBuilder Developer |
Indy 9: EIdTerminateThreadTimeout2005-01-31 10:24:27 PM cppbuilder60 Hello World, When setting TIdTCPServer->Active = false (and clients are connected to the server) the application throws EIdTerminateThreadTimeout. As soon as there is no client connected, the application remains running.... Using BCB6 and Indy 9 |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-02-01 02:45:06 AM
Re:Indy 9: EIdTerminateThreadTimeout
"Herwig" < XXXX@XXXXX.COM >wrote in message
QuoteWhen setting TIdTCPServer->Active = false (and clients are code. Gambit |
Herwig
![]() CBuilder Developer |
2005-02-02 05:33:47 PM
Re:Indy 9: EIdTerminateThreadTimeoutQuoteThat happens when the server's threads that are servicing clients do not .hpp: ----------------------- #ifndef Unit1H #define Unit1H #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <IdBaseComponent.hpp> #include <IdComponent.hpp> #include <IdTCPServer.hpp> class TForm1 : public TForm { __published: TMemo *Memo1; TButton *Button1; TButton *Button2; void __fastcall Button1Click(TObject *Sender); public: __fastcall TForm1(TComponent* Owner); TIdTCPServer *Server; void __fastcall ClientExecute(TIdPeerThread *AThread); void __fastcall ClientConnect(TIdPeerThread *AThread); void __fastcall ClientDisconnect(TIdPeerThread *AThread); }; extern PACKAGE TForm1 *Form1; #endif ----------------------- .cpp: ----------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { this->Server = new TIdTCPServer( Owner ); this->Server->DefaultPort = 48888; this->Server->OnConnect = ClientConnect; this->Server->OnExecute = ClientExecute; this->Server->OnDisconnect = ClientDisconnect; TIdSocketHandle *b = this->Server->Bindings->Add(); b->Port = 48888; } void __fastcall TForm1::ClientExecute(TIdPeerThread *AThread) { Memo1->Lines->Add( AThread->Connection->ReadLn(EOL,1000) ); } void __fastcall TForm1::ClientConnect(TIdPeerThread *AThread) { Memo1->Lines->Add( (AnsiString) "Client Connected: " + AThread->Connection->Socket->Binding->PeerIP ); } void __fastcall TForm1::Button1Click(TObject *Sender) { this->Server->Active = !this->Server->Active; } void __fastcall TForm1::ClientDisconnect(TIdPeerThread *AThread) { // As soon as the application does something "OnDisconnect", the exception occurs... Memo1->Lines->Add( (AnsiString) "Client Disconnecting: " + AThread->Connection->Socket->Binding->PeerIP ); } ----------------------- {smallsort} |