L
lianyuan
Unregistered / Unconfirmed
GUEST, unregistred user!
public
{ Public declarations }
stream : TMemoryStream;
size,count : integer
procedure TForm1.Button3Click(Sender: TObject);
begin
stream := TMemoryStream.Create; //流初始化
stream.LoadFromFile(ExtractFilePath(Application.ExeName)+'mmx.zip');
size := stream.Size;
count := 0; //记录位置
CSocket1.Socket.SendText(inttostr(size)); //发送文件大小
end;
procedure TForm1.CSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
rcvtxt : string;
buf : array [1..8192] of char;
left : integer; //剩余的字节数
begin
memo1.Lines.Add(Socket.ReceiveText);
rcvtxt := Socket.ReceiveText;
left := size-count; //剩余的字节数
if AnsiPos('go',rcvtxt)=1 then //收方响应了则发送一块
begin
if sizeof(buf)<left then
begin
stream.Read(buf,sizeof(buf));
Socket.SendBuf(buf,sizeof(buf));
count := count + sizeof(buf);
end
else
begin
stream.Read(buf,left);
Socket.SendBuf(buf,left);
end;
end;
end;
我在公司的任何两台机子上都通过了;但是在向服务器发送时(服务器是在广东的),服务器能收得我的发送请求,却总是收不到数据!不知道是怎么回事!
哪位大侠帮忙看看啊,能给源码是最好的了!我的E-mail: lianyuan@21cm.com
急啊!!!
{ Public declarations }
stream : TMemoryStream;
size,count : integer
procedure TForm1.Button3Click(Sender: TObject);
begin
stream := TMemoryStream.Create; //流初始化
stream.LoadFromFile(ExtractFilePath(Application.ExeName)+'mmx.zip');
size := stream.Size;
count := 0; //记录位置
CSocket1.Socket.SendText(inttostr(size)); //发送文件大小
end;
procedure TForm1.CSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
rcvtxt : string;
buf : array [1..8192] of char;
left : integer; //剩余的字节数
begin
memo1.Lines.Add(Socket.ReceiveText);
rcvtxt := Socket.ReceiveText;
left := size-count; //剩余的字节数
if AnsiPos('go',rcvtxt)=1 then //收方响应了则发送一块
begin
if sizeof(buf)<left then
begin
stream.Read(buf,sizeof(buf));
Socket.SendBuf(buf,sizeof(buf));
count := count + sizeof(buf);
end
else
begin
stream.Read(buf,left);
Socket.SendBuf(buf,left);
end;
end;
end;
我在公司的任何两台机子上都通过了;但是在向服务器发送时(服务器是在广东的),服务器能收得我的发送请求,却总是收不到数据!不知道是怎么回事!
哪位大侠帮忙看看啊,能给源码是最好的了!我的E-mail: lianyuan@21cm.com
急啊!!!