Ach ja eines noch wieso vertauschts du eigentlich Server und Client, dann fehlen dir doch schöne Proceduren wie connecting,Error,OnRead,....
Wieso machst du das nicht so von der Art her?Nur ein Tipp!
Server:
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
Server.Port:=25544;
server.Open;
end;
procedure TForm1.ServerClientRead(Sender: TObject;
Socket: TCustomWinSocket);
begin
MessageDlg(Socket.ReceiveText, mtInformation, [mbOK], 1);
Form1.Caption:='nachricht';
end;
procedure TForm1.ServerClientConnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
Form1.Caption:='connected';
end;
procedure TForm1.ServerClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
Form1.Caption:='Disconnected';
end;
CLIENT:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
client.Port:=25544;
{muss der gleiche sein}
client.Address:=Edit1.Text;
{IP oder PC-name}
client.Open;
end;
procedure TForm1.ClientConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
Form1.Caption:='
connected';
end;
procedure TForm1.ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
Form1.Caption:='
disconnected';
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Client.Close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
client.Socket.SendText(Edit2.Text);
end;
@wardz