DataSnapサーバー/クライアント間でいくつかの大きなストリーム(〜1Mb)を転送しようとしていますが、役に立ちません。ジム・ティアニー( http://blogs.embarcadero.com/jimtierney/2009/04/06/31461 )のコードをうまく理解しようとしていますが、ライブラリがないためにコードをコンパイルすることさえできません。とりあえず ...
私が受信できるストリームの最大サイズは64kなので、私のような週末のプログラマーに提供できるヒント/アイデア/コードサンプルは大歓迎です。ありがとうございました!
私のサーバーコード:
function TsrvMethods.getStream(iCount: integer): TStream;
begin
Result := dummyStream('0123456789', iCount);
end;
function dummyStream(sCnt: string; iCount: integer): TStream;
begin
Result := TMemoryStream.Create;
while iCount > 1 do begin
Result.Write(Pointer(sCnt)^, Length(sCnt));
Dec(iCount);
end;
Result.Seek(0, TSeekOrigin.soBeginning);
end;
私のクライアントの呼び出しコード:
procedure TfrmMain.butStreamClick(Sender: TObject);
var
sStr : TStream;
begin
cycleConnection; //make sure we have an active connection
with TsrvMethodsClient.Create( SQLConn.DBXConnection, False ) do begin
sStr := getStream( Integer(SpinCount.Value) );
Free;
end;
FreeAndNil(sStr);
end;