不用什么,在中间件加入一个方法就可实现:
server:
function GetFile(const FileName: string): OleVariant;
var
P: Pointer;
begin
VarClear(Result);//不知D5有没。
with TFileStream.Create(FileName, fmShareDenyNone)do
try
Result := VarArrayCreate([0, Size], varByte);
P := VarArrayLock(Result);
Read(P^, Size);
finally
Free;
VarArrayUnLock(Result);
end;
end;
client;
procedure GetFile(const FileName: string);
var
P: Pointer;
Data: OleVariant;
Count: Integer;
begin
Data := SocketConnection1.AppServer.GetFile(FileName);
with TFileStream.Create('c:/temp/'+ ExtractFileName(FileName), fmCreate)do
try
P := VarArrayLock(Data);
Count := VarArrayHighBound(Data, 1);
Write(P^, Count);
finally
Free;
VarArrayUnLock(Data);
end;
end;