Delphi-Quellcode:
//Client
procedure TForm1.senden;
var TextStream : TStringStream;
begin
textstream:=TStringStream.Create(ListBox1.CommaText);
textstream.Position:=0;
ClientSocket1.Socket.SendStream(textstream);
end;
//Server
procedure TForm1.ServerSocket1ClientRead(Sender: TObject; Socket: TCustomWinSocket);
var iLen: Integer;
Bfr: Pointer;
text: TStringStream;
begin
iLen := Socket.ReceiveLength;
GetMem(Bfr, iLen);
Socket.ReceiveBuf(Bfr^, iLen);
text:=TStringStream.Create('');
text.Write(Bfr^, iLen);
text.Position:=0;
ListBox1.Lines.Add(text.DataString);
end;
habs net getestet müsste aber so gehen.