C Builder中用socketapi来写网络通讯程序(2)计算机等级考试
文章作者 100test 发表时间 2010:01:01 13:03:23
来源 100Test.Com百考试题网
//******************************CLASS TCommunication For TCP****************************************************
__fastcall TCommunication::TCommunication(SOCKET m_Socket,bool CreateSuspended):TThread(FALSE)
{
m_AcceptSocket=m_Socket.
szTmp[0]= \0 .
FreeOnTerminate=true.
}
__fastcall TCommunication::~TCommunication()
{
// closesocket(m_AcceptSocket).
}
void __fastcall TCommunication::Execute()
{
char buf[4096].
int nSize=0.
nSize=recv(m_AcceptSocket,(char FAR*)buf,4096,0).
if(nSize