unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ScktComp, StdCtrls;
type
currentplayers =
record
name :
array[1..8]
of string[10];
number : integer;
end;
TForm1 =
class(TForm)
ServerSocket1: TServerSocket;
memo1: TMemo;
ListBox1: TListBox;
procedure ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure send(
var rec : currentplayers; art,msg,all :
string);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
first : boolean;
//entweder/oder für onclientread
art :
string;
//was wird gesendet
player : currentplayers;
//speichert wieviel spieler connected sind und deren namen
ohne : integer;
//an welche connection wird nicht gesendet
a,b,c : integer;
// counter
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
serversocket1.port := 1337;
serversocket1.Active := true;
// starte connection
first := true;
player.number := 0;
ohne := -1;
end;