J
jstkof
Unregistered / Unconfirmed
GUEST, unregistred user!
我想把文件从一台机器传到另一台机器,用clientsocket和serversocket应该怎么写?
另外,请大家看一下为什么下面的代码不起作用呢?(我想拷贝文件s1到s2,不想用
copyfrom,因为socket好像没有copyfrom方法)
var
s1,s2:TFileStream;
begin
if opendialog1.Execute then
begin
s1:=TFileStream.Create(opendialog1.filename,fmopenread);
try
if opendialog1.Execute then
begin
s2:=TFileStream.Create(opendialog1.filename,
fmopenwrite or fmCreate);
try
//s2.CopyFrom(s1,s1.size);
s2.read(s1,s1.size);
finally
s2.free;
end;
end;
finally
s1.Free;
end;
end;
end;
另外,请大家看一下为什么下面的代码不起作用呢?(我想拷贝文件s1到s2,不想用
copyfrom,因为socket好像没有copyfrom方法)
var
s1,s2:TFileStream;
begin
if opendialog1.Execute then
begin
s1:=TFileStream.Create(opendialog1.filename,fmopenread);
try
if opendialog1.Execute then
begin
s2:=TFileStream.Create(opendialog1.filename,
fmopenwrite or fmCreate);
try
//s2.CopyFrom(s1,s1.size);
s2.read(s1,s1.size);
finally
s2.free;
end;
end;
finally
s1.Free;
end;
end;
end;