var
Form1: TForm1;
clientcount: Integer=0;
implementation
{$R *.DFM}
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
begin
memo1.Lines.Add(Socket.ReceiveText);
end;
procedure TForm1.SenderClick(Sender: TObject);
begin
memo1.Lines.Add(User.text+'
: '+senden.text);
Senden.text := '
';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
ClientSocket1.Active := false;
ClientSocket1.Host := Host.Text;
ClientSocket1.Active := true;
end;
procedure TForm1.ServerSocket1ClientConnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
inc(Clientcount);
end;
procedure TForm1.ServerSocket1ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
dec(Clientcount);
end;
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
i: Integer;
t:
string;
begin
t := Socket.receivetext;
for i := 0
to Clientcount-1
do
Serversocket1.Socket.Connections[1].SendText(t);
memo1.lines.add(t);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
ClientSocket1.Active := false;
end;