ich hab ein chatprog geschrieben wo der client den server text sendet und der server den client text senden soll.
aber das funzt nicht.
client
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
clientsocket1.open;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if Clientsocket1.Active = true then Clientsocket1.Socket.SendText(Edit1.Text);
Edit1.Text:='';
end;
procedure TForm1.ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
begin
Memo1.Lines.Add('***Connected.')
end;
procedure TForm1.ClientSocket1Disconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
Memo1.Lines.Add('***Disconnected.');
end;
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
begin
Memo1.Lines.Add(Socket.ReceiveText);
end;
end.
server
Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
serversocket1.Open;
end;
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
begin
Memo1.Lines.Add(Socket.ReceiveText);
end;
procedure TForm1.ServerSocket1ClientWrite(Sender: TObject;
Socket: TCustomWinSocket);
begin
serversocket1.Socket.SendText(Edit1.Text);
Edit1.Text:='';
end;
end.
was ist da falsch ?
mfg vader