Board index » cppbuilder » Indy 9: EIdTerminateThreadTimeout

Indy 9: EIdTerminateThreadTimeout


2005-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
 
 

Re:Indy 9: EIdTerminateThreadTimeout

"Herwig" < XXXX@XXXXX.COM >wrote in message
Quote
When setting TIdTCPServer->Active = false (and clients are
connected to the server) the application throws
EIdTerminateThreadTimeout.
That happens when the server's threads that are servicing clients do not
terminate themselves in a timely fashion. Please show your actual server
code.
Gambit
 

Re:Indy 9: EIdTerminateThreadTimeout

Quote
That happens when the server's threads that are servicing clients do not
terminate themselves in a timely fashion. Please show your actual server
The problem seems only to occur when I do something within 'OnDisconnect...'
Here we are:
.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}