1,593
社区成员
发帖
与我相关
我的任务
分享
把线程去掉,循环2次,for i=0 to 1 do
begin
通讯过程
end;
调试下通讯过程。就知道对方到底发了几次
While (Not Terminated)And FOwner.Active Do
begin
nTickCount := GetTickCount;
If FOwner.FSockStream.WaitForData(FOwner.ReadTimeout) Then // 如果有数据到来
If Not Terminated Then
Repeat
Begin
BytesDone:= FOwner.FSockStream.Read(FReadBuf, 65536);
// 可能错误
If BytesDone = 0 Then
begin
if (GetTickCount - nTickCount)<FOwner.ReadTimeout then
begin
FOwner.Close;
FOwner.FWriteThread.udSuspend;
//重连
FOwner.FWorkThread.FReConnectEvent.SetEvent;
//休眠自己
Suspend;
end;
end