|
OnGetThread 이벤트 함수에서 서비스를 위한 스레드를 생성해서 등록해야 하는데
도저히 방법을 모르겠습니다.
도움말에 있는 방식으로 다음과 같이 만들면 에러가 나는군요.
컨스트럭터 부분도 없는데 어찌 만들라는 얘기인지 도무지 알 수가 없군요.
고수님의 도움을 간절히 기다립니다.
도움말에 있는 내용...을 퍼왔습니다.
class PACKAGE TMyServerThread : public ScktComp::TServerClientThread
{
public
void __fastcall ClientExecute(void);
}
void __fastcall TMyServerThread::ClientExecute()
{
while (!Terminated && ClientSocket->Connected) // make sure connection is active
{
try
{
TWinSocketStream *pStream = new TWinSocketStream(ClientSocket, 60000);
try
{
char buffer[10];
memset(buffer, 0, sizeof(buffer));
if (pStream->WaitForData(60000)) // give the client 60 seconds to start writing
{
if (pStream->Read(buffer, sizeof(buffer) == 0)
ClientSocket->Close(); // if can't read in 60 seconds, close the connection
// now process the request
...
}
else
ClientSocket->Close();
}
__finally
{
delete pStream;
}
}
catch (...)
{
HandleException();
}
}
}
|