|
클라이언트로부터 데이터를 계속 검출해내는 프로그램인데요..
서버쪽에서 ReadBuffer로 들어가서 블럭 되버리는 현상이 있습니다..
어떻게 해결을 해야할까요.. ㅠㅠ
코드는 다음과 같습니다..
void __fastcall TMainForm::TracerServerExecute(TIdPeerThread *AThread)
{
Controller *pScon;
pScon = (StackController *)(AThread->Data);
try
{
pScon->RecvMsg();
}
catch(...)
{
//pScon->DisConnect(); // TODO:: 개선해 보자 !!
AThread->Connection->Disconnect();
}
pScon->ProcessMsg();
if( (pScon->RxMsg.hd.prim == START_RESP) || (pScon->RxMsg.hd.prim == STOP_RESP))
g_nTotalMsgCnt = 0;
if (pScon->RxMsg.hd.prim == MESSAGE)
{
g_nTotalMsgCnt++;
if (CaptureFileStatusForm){
EnterCriticalSection (&CriticalSection);
CaptureFileStatusForm->UpdateContents(&(pScon->RxMsg));
LeaveCriticalSection (&CriticalSection);
}
}
}
}
//---------------------------------------------------------------------------
int __fastcall Controller::RecvMsg ()
{
if ( (pOwnerThread->Terminated) || !(pOwnerThread->Connection->Connected()))
return NULL;
pOwnerThread->Connection->ReadBuffer (&RxMsg.hd, sizeof(ScMH));
if (RxMsg.hd.len)
{
pOwnerThread->Connection->ReadBuffer (RxMsg.msgBody, RxMsg.hd.len);
}
return RxMsg.hd.prim;
}
//---------------------------------------------------------------------------
TrMonConn * __fastcall Controller::ProcessMsg ()
{
if ( (pOwnerThread->Terminated) || !(pOwnerThread->Connection->Connected()))
return NULL;
switch (RxMsg.hd.prim)
{
case RESP:
break;
default:
break;
}
return tmc;
}
//---------------------------------------------------------------------------
|