|
음... 안녕하세요. 반갑습니다.
indy를 사용해서 프로그램을 하고 있는데요...
해결이 않되는 문제가 있습니다. 왜그럴까???
서버와 클라이언트가 접속이되어서 데이터를 주고 받을때는 아무런 문제가 없고,
정상적으로 종료를 시켜서 진행을 하면 문제가 없는데~
어느 한쪽을 power off시켜서 강제로 종료해버리면
첨부와 같은 에러가 나옵니다. 그것도 몇십개나...
왜그럴까요?? 어떻게하면 해결이 될까요.... ??? 정말 궁금합니다.
대략의 내용은 아래와 같습니다.
////////////////////////////////////////////////////////////////////////////////
void __fastcall TfrmMain::TCPServerExecute(TIdPeerThread *AThread)
{
String CMD;
String RevMsg;
FCommModule* m_pRev;
try {
Application->ProcessMessages();
RevMsg = AThread->Connection->ReadLn();
m_pRev = (FCommModule*)AThread->Data;
}
catch(Exception& e) {
return;
}
if(RevMsg.Length() <= 0 ) return; //empty data
try {
CMD = RevMsg.SubString(1, 2);
FlashLED(nlsID, false); //수신되었다.
/////...............///////////////
}
}
////////////////////////////////////////////////////////////////////////////////
void __fastcall TfrmMain::TCPServerDisconnect(TIdPeerThread *AThread)
{
// Retrieve Client Record from Data pointer
FCommModule* pdis = (FCommModule*) AThread->Data;
AThread->Connection->Disconnect();
// AThread->Connection->DisconnectSocket();
// Remove Client from the Clients ThreadList
TList* pList = m_lstComModuel->LockList();
try {
pList->Remove( pdis ) ;
}
__finally {
m_lstComModuel->UnlockList();
}
// Free the Client object
if(pdis != NULL) {
delete pdis; pdis = NULL;
}
AThread->Data = NULL;
}
////////////////////////////////////////////////////////////////////////////////
// 서버에서 클라이언트로 데이터를 보낼때~
// Timer를 사용해서 주기적으로 계속 보내고, 받습니다.
void __fastcall TfrmMain::tmrDCTimerTimer(TObject *Sender)
{
if( m_bDaqStarted == true) {
Application->ProcessMessages();
SendDaqStartToAll();
}
}
|