unit u_Server;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ScktComp, StdCtrls;
type
TForm1 =
class(TForm)
Memo1: TMemo;
Button1: TButton;
ServerSocket1: TServerSocket;
Edit1: TEdit;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure ServerSocketClientRead(Sender: TObject; Socket: TCustomWinSocket);
procedure ServerSocketClientConnect(Sender: TObject; Socket: TCustomWinSocket);
procedure ServerSocketClientListen(Sender: TObject; Socket: TCustomWinSocket);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
ServerSocket1.Port:= strtoint(edit1.text);
ServerSocket1.Active:= true;
end;
procedure TForm1.ServerSocketClientRead(Sender: TObject; Socket: TCustomWinSocket);
begin
Memo1.Lines.Add(Socket.ReceiveText);
end;
procedure TForm1.ServerSocketClientConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
Memo1.Lines.Add('
Client angeschlossen');
end;
procedure TForm1.ServerSocketClientListen(Sender: TObject; Socket: TCustomWinSocket);
begin
Memo1.Lines.Add('
Client auf dem Weg');
end;
end.