to OopsWare:
我用 TWinSocketStream 接收不到信息是什么原因
注释中的是我原来的代码
void __fastcall TSrvrClntThrd::ClientExecute(void)
{
int ReceiveLength = ClientSocket->ReceiveLength();
void* Buf = AllocMem( ReceiveLength+1 );
ClientSocket->ReceiveBuf( Buf, ReceiveLength );
// ShowMessage( (char*)Buf );
PostMessage( TradeMsgRollForm->Handle, XXX, (unsigned int)Buf, 0 );
/*
while( !Terminated && ClientSocket->Connected )
{
TWinSocketStream* pStream = new TWinSocketStream( ClientSocket, 60000 );
try
{
int ReceiveLength = ClientSocket->ReceiveLength();
void* Buf = AllocMem( ReceiveLength+1 );
ClientSocket->ReceiveBuf( Buf, ReceiveLength );
//PostMessage( TradeMsgRollForm->Handle, XXX, (unsigned int)Buf, 0 );
if( pStream->WaitForData(60000) )
{
if( pStream->Read(Buf,ReceiveLength) == 0 )
ClientSocket->Close();
AnsiString TestBuf = (char*)Buf;
PostMessage( TerminalMsgRollForm->Handle, XXX, (unsigned int)Buf, 0 );
}
else
{
delete Buf;
}
}
__finally
{
delete pStream;
}
}
*/
}