D
dfs
Unregistered / Unconfirmed
GUEST, unregistred user!
部分代码如下:
try
GetMem(bufSend,iBYTEPERSEND+1);
if (fsSend.Position+1+iBYTEPERSEND) < fsSend.Size then
begin
ssize:=ssize+1;
sb.Panels[0].Text:='已发送'+inttostr(ssize)+'次';
sb.Panels[2].Text:=inttostr(trunc(fssend.Position*100/fssend.Size))+'%' ;
fsSend.Read(bufSend^,iBYTEPERSEND);
Socket.SendBuf(bufSend^,iBYTEPERSEND);
pb.Position:=trunc(fssend.Position*100/fssend.Size);
//
end//普通的发送,大小为iBYTEPERSEND
else begin
fsSend.Read(bufSend^,fsSend.Size-fsSend.Position-1);
Socket.SendBuf(bufSend^,fsSend.Size-fsSend.Position-1);
ssize:=ssize+1;
sb.Panels[0].Text:='已发送'+inttostr(ssize)+'次';
sb.Panels[2].Text:=inttostr(trunc(fssend.Position*100/fssend.Size))+'%' ;
pb.Position:=trunc(fssend.Position*100/fssend.Size);
over:=true;
ShowMessage('Send over!');
//fsSend.Free;
end;//最后一次发送,发送剩余的数据
finally
FreeMem(bufSend,iBYTEPERSEND+1);
end;{of try}
问题是最后一次发送完后,接受端没有受到数据(没有触发onread)事件。而前面那些传
送的数据都能够收到。
try
GetMem(bufSend,iBYTEPERSEND+1);
if (fsSend.Position+1+iBYTEPERSEND) < fsSend.Size then
begin
ssize:=ssize+1;
sb.Panels[0].Text:='已发送'+inttostr(ssize)+'次';
sb.Panels[2].Text:=inttostr(trunc(fssend.Position*100/fssend.Size))+'%' ;
fsSend.Read(bufSend^,iBYTEPERSEND);
Socket.SendBuf(bufSend^,iBYTEPERSEND);
pb.Position:=trunc(fssend.Position*100/fssend.Size);
//
end//普通的发送,大小为iBYTEPERSEND
else begin
fsSend.Read(bufSend^,fsSend.Size-fsSend.Position-1);
Socket.SendBuf(bufSend^,fsSend.Size-fsSend.Position-1);
ssize:=ssize+1;
sb.Panels[0].Text:='已发送'+inttostr(ssize)+'次';
sb.Panels[2].Text:=inttostr(trunc(fssend.Position*100/fssend.Size))+'%' ;
pb.Position:=trunc(fssend.Position*100/fssend.Size);
over:=true;
ShowMessage('Send over!');
//fsSend.Free;
end;//最后一次发送,发送剩余的数据
finally
FreeMem(bufSend,iBYTEPERSEND+1);
end;{of try}
问题是最后一次发送完后,接受端没有受到数据(没有触发onread)事件。而前面那些传
送的数据都能够收到。