以下是一段用socket來傳送和接收文件的代碼.
程序在接收時有觸發onread事件,但在發送時使用sendstream卻沒有.
想問的是:如何才能得知程序正在使用sendstream傳送文件中?
procedure TForm1.cs3Read(Sender: TObject; Socket: TCustomWinSocket);
var
len3:integer;
buf3:array [0..10000] of byte;
begincounter:=counter+1;  //counter:=1;
caption:=inttostr(counter);  //發送時使用sendstream,counter加1後就沒再繼續增加if (updown=222) and (socket.ReceiveText='go~') then  //send file
begin
socket.SendStream(fs3);
exit;
end;if updown=111 then  //receive file
begin
filesize:=strtoint(socket.ReceiveText);
updown:=999;
socket.SendText('go~');
end
else
begin
len3:=socket.ReceiveLength;
socket.ReceiveBuf(buf3,len3);
if fs3.Size < filesize then
fs3.Write(buf3,len3);
if fs3.Size >= filesize then
 begin
 fs3.Free;
 socket.Close;
 end;
end;