关于多线程通讯。急急急!!!
头文件main.h中包含定义
class PACKAGE TMyServerThread : public Scktcomp::TServerClientThread
{
public:
void __fastcall ClientExecute(void);
};
实现文件main.cpp中包含
void __fastcall TMyServerThread::ClientExecute()
{
while (!Terminated && ClientSocket->Connected) // make sure connection is active
{
try
{
TWinSocketStream *pStream = new TWinSocketStream(ClientSocket, 60000);
try
{
char buffer[50];
memset(buffer, 0, sizeof(buffer));
if (pStream->WaitForData(6000)) // 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();
}
}
}
//------------------------------------------------------------------------
void __fastcall TfrmMain::sstMainGetThread(TObject *Sender,
TServerClientWinSocket *ClientSocket,
TServerClientThread *&SocketThread)
{
SocketThread = new TMyServerThread(false,ClientSocket);
}
报错:[C++ Error] main.cpp(301): E2125 Compiler could not generate default constructor for class 'TMyServerThread'。
望各位大虾指点.