also dann sowas in der art oder wie?
(hier jetzt einfach mal am beispiel von einem Screenshot, den muss man nicht aus ner datei laden)
Client
Delphi-Quellcode:
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
Stream : TMemoryStream;
begin
Stream := TMemoryStream.Create;
clientsocket1.Socket.ReceiveBuf(stream,sizeof(stream));
image1.Picture.Bitmap.LoadFromStream(stream);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Port := 270;
//Festlegung des Ports
ClientSocket1.Host := '
127.0.0.1';
//IP des Zielrechners
ClientSocket1.active := true;
//Aufbau der Verbindung
end;
Server
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
ServerSocket1.Port := 270; //Festlegung des Ports
ServerSocket1.active := true; //Aktivierung der ServerSocket
end;
{procedure MakeScreenShot(const ATarget: TBitmap);
var
DesktopDC: HDC;
begin
DesktopDC := CreateDC('DISPLAY', nil, nil, nil);
try
ATarget.PixelFormat := pfDevice;
ATarget.Width := Screen.Width;
ATarget.Height := Screen.Height;
BitBlt(ATarget.Canvas.Handle, 0, 0, Screen.Width, Screen.Height, DesktopDC, 0, 0, SRCCOPY);
finally
DeleteDC(DesktopDC);
end;
end;} <--irrelevant
procedure TForm1.Button1Click(Sender: TObject);
var
Stream : TMemoryStream;
bitmap:Tbitmap;
begin
Stream := TMemoryStream.Create;
MakeScreenShot(bitmap);
bitmap.SaveToStream(Stream);
Stream.Position := 0;
Stream.Free;
Serversocket1.Socket.Connections[0].SendStream(Stream);
end;