TIdTCPServer收信问题

glassegg 2005-11-01 08:31:32
在void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
中,用string buf = ReadLn();怎么没有反应?
用CurrentReadBuffer()倒是可以,不过没有timeout>
是不是收信,还和数据有无回车符有关?

小弟刚接触indy,想做TCPserver端,请赐教

希望server端可以收发信息

void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
{

}
...全文
182 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
EastWinder 2005-11-02
  • 打赏
  • 举报
回复
AThread->Connection->ReadLn();要接收带回车符的数据,
没有回车符的话,你可以用:
AThread->Connection->ReadStrings();
AThread->Connection->ReadBuffer();
glassegg 2005-11-02
  • 打赏
  • 举报
回复
---> AThread->Connection->ReadStrings();
AThread->Connection->ReadBuffer();
线程就在等待接收,不能随时发送信息了。
有没有判断受到信息后,才接收信息的属性?
这样就可以不影响送信了。
或者,我实在乱说(不懂)

13,826

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧