unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Sockets, StdCtrls;
type
TChat1 =
class(TForm)
Svverbinden: TButton;
Adresse: TEdit;
Port: TEdit;
Clverbinden: TButton;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
port2: TEdit;
Senden: TButton;
Nachr: TMemo;
client: TTcpClient;
server: TTcpServer;
procedure SvverbindenClick(Sender: TObject);
procedure ClverbindenClick(Sender: TObject);
procedure SendenClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Chat1: TChat1;
implementation
{$R *.dfm}
procedure TChat1.SvverbindenClick(Sender: TObject);
begin
server.Active := false;
server.LocalPort := port.Text;
server.Active := true;
end;
procedure TChat1.ClverbindenClick(Sender: TObject);
begin
client.RemoteHost := adresse.Text;
client.RemotePort := port2.Text;
end;
procedure TChat1.SendenClick(Sender: TObject);
begin
if client.Connect
then
try
client.Sendln(nachr.Text)
finally
client.Disconnect;
end;
end;
end.