unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ScktComp, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Image1: TImage;
Button2: TButton;
Image2: TImage;
ClientSocket1: TClientSocket;
ServerSocket1: TServerSocket;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ServerSocket1Accept(Sender: TObject;
Socket: TCustomWinSocket);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
clientsocket1.Active:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
FStream : Tfilestream;
begin
FStream := TFileStream.Create('
C:\Dokumente und Einstellungen\MattiVsRob\Desktop\maus.jpg', fmOpenRead);
clientsocket1.Socket.SendStream(FStream);
end;
procedure TForm1.ServerSocket1Accept(Sender: TObject;
Socket: TCustomWinSocket);
var
stream:Tfilestream;
begin
serversocket1.Socket.ReceiveBuf(stream, 1);
Stream := TFileStream.Create('
C:\Dokumente und Einstellungen\MattiVsRob\Desktop\maus1.jpg', fmCreate
or fmOpenWrite);
stream.free ;
end;
end.