C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[28785] Indy TCP Server에서 ReadBuffer 블럭되는 현상이 있어요..
김형두 [volcano71] 1592 읽음    2004-02-12 02:48
클라이언트로부터 데이터를 계속 검출해내는 프로그램인데요..
서버쪽에서 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;
}
//---------------------------------------------------------------------------

+ -

관련 글 리스트
28785 Indy TCP Server에서 ReadBuffer 블럭되는 현상이 있어요.. 김형두 1592 2004/02/12
34456     Re:Indy TCP Server에서 ReadBuffer 블럭되는 현상이 있어요.. 김태선 1024 2004/02/13
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.