宇
宇宙神
Unregistered / Unconfirmed
GUEST, unregistred user!
请教:(socket)服务器端怎么把接收的流形成文件?谢谢!
客户端
procedure TForm1.Button1Click(Sender: TObject);
var
mystream: TMemoryStream;
filename:string; //ini 文件路径
begin
filename:=ExtractFilePath(paramstr(0))+'22.txt';
mystream := TMemoryStream.Create;
mystream.LoadFromFile(filename);
mystream.position := 0; //加上这句看看
ClientSocket1.Socket.SendStream(mystream);
while(isjudge) do
begin
mystream.free;
isjudge:=false;
end;
end;
服务器端:
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
mystream:TMemoryStream;
begin
//len:=Socket.ReceiveLength;
//Socket.ReceiveBuf(mystream, Len);
end;
我这里怎么接收客户端发来的流
我想把接收的流再形成文件
这样的程序是怎么写?
谢谢!
客户端
procedure TForm1.Button1Click(Sender: TObject);
var
mystream: TMemoryStream;
filename:string; //ini 文件路径
begin
filename:=ExtractFilePath(paramstr(0))+'22.txt';
mystream := TMemoryStream.Create;
mystream.LoadFromFile(filename);
mystream.position := 0; //加上这句看看
ClientSocket1.Socket.SendStream(mystream);
while(isjudge) do
begin
mystream.free;
isjudge:=false;
end;
end;
服务器端:
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
mystream:TMemoryStream;
begin
//len:=Socket.ReceiveLength;
//Socket.ReceiveBuf(mystream, Len);
end;
我这里怎么接收客户端发来的流
我想把接收的流再形成文件
这样的程序是怎么写?
谢谢!