源:IdTCP的C++Builder2010示例

 

IdTCP的C++Builder2010示例

这个是服务端的:

void __fastcall TTCPDataServer::TCPServerExecute(TIdContext *AContext)
{
    AnsiString Str;
    Str=AContext->Connection->IOHandler->ReadLn();
    if (Str=="")
        Str="Error,String is Emtry";
    AContext->Connection->IOHandler->WriteLn(Str);
    AContext->Connection->Disconnect(true);
}

 

这个是客户端的:

try
{
    IdTCPClient->Connect();
}
catch(Exception &e)
{
    ShowMessage(e.Message);
}
 IdTCPClient->IOHandler->WriteLn("0");
 ShowMessage(IdTCPClient->IOHandler->ReadLn());
 IdTCPClient->Disconnect();

 

相关文章:

  • 2021-10-09
  • 2022-02-15
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2021-10-25
  • 2021-07-23
相关资源
相似解决方案