Thema: Delphi WinSocket Bild versenden

Einzelnen Beitrag anzeigen

Tzuxy

Registriert seit: 17. Aug 2004
51 Beiträge
 
#5

Re: WinSocket Bild versenden

  Alt 14. Nov 2004, 14:55
So hab das ma versucht. keine fehlermeldung, aber wird nichts übrtragen
Delphi-Quellcode:
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.
  Mit Zitat antworten Zitat