unit Server;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdCustomTCPServer, IdStreamvcl, IdTCPServer, idcontext;
type
TForm1 =
class(TForm)
IdTCPServer1: TIdTCPServer;
procedure FormCreate(Sender: TObject);
procedure IdTCPServer1Execute(AContext: TIdContext);
private
public
end;
const
filename='
h:\Test.bmp';
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
IdTCPServer1.Active:=true;
end;
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
Var
FStream: TFileStream;
begin
FStream := TFileStream.Create(filename, fmCreate);
FStream.Position := 0;
AContext.Connection.Socket.ReadStream(fstream);
AContext.Connection.Disconnect;
FStream.Destroy;
end;
end.