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
[7839] NT Service 에러
제임스 [] 1775 읽음    2001-05-29 14:18
다음 소스에서 에러가 발생하는군요.

포트가 이미 열려 있을 경우 에러를 발생시키고 Stop이 되어야하는데

시작하는중에서 멈춰있습니다. 다시 uninstall하면 실패 또 install해도 실패입니다.


이러한 이유가 발생하는 원인이 뭔지 잘 모르겠네요..미칠거 같습니다.

좀 도와주십시오. 아래에 코드가 있습니다.


//---------------------------------------------------------------------------
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

TtestV *testV;
//---------------------------------------------------------------------------
__fastcall TtestV::TtestV(TComponent* Owner)
    : TService(Owner)
{
}

TServiceController __fastcall TtestV::GetServiceController(void)
{
    return (TServiceController) ServiceController;
}

void __stdcall ServiceController(unsigned CtrlCode)
{
    testV->Controller(CtrlCode);
}
//---------------------------------------------------------------------------
void __fastcall TtestV::ServiceStart(TService *Sender, bool &Started)
{
    try {
        ServerSocket1->Port=4444;
        ServerSocket1->ServerType=stNonBlocking;
        ServerSocket1->Active=true;
    }
    catch (ESocketError &e) {

        ShowMessage (e.Message);
        Started=false;
        return;
    }
    Started=true;


}
//---------------------------------------------------------------------------
void __fastcall TtestV::ServiceStop(TService *Sender, bool &Stopped)
{
    ServerSocket1->Active=false;
    Stopped=true;   
}
//---------------------------------------------------------------------------
void __fastcall TtestV::ServiceExecute(TService *Sender)
{
    while (!Terminated)
        ServiceThread->ProcessRequests(false);   
}
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <SvcMgr.hpp>
#include <vcl.h>
#include <ScktComp.hpp>
//---------------------------------------------------------------------------
class TtestV : public TService
{
__published:    // IDE-managed Components
    TServerSocket *ServerSocket1;
    void __fastcall ServiceStart(TService *Sender, bool &Started);
    void __fastcall ServiceStop(TService *Sender, bool &Stopped);
    void __fastcall ServiceExecute(TService *Sender);
private:        // User declarations
public:         // User declarations
    __fastcall TtestV(TComponent* Owner);
    TServiceController __fastcall GetServiceController(void);

    friend void __stdcall ServiceController(unsigned CtrlCode);
};
//---------------------------------------------------------------------------
extern PACKAGE TtestV *testV;
//---------------------------------------------------------------------------
#endif

+ -

관련 글 리스트
7839 NT Service 에러 제임스 1775 2001/05/29
7842     Re:NT Service 에러 최혜원.시리 1518 2001/05/29
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.