I have a Client and a server application, very simple code and it is working.
But with the client, I can send one time a message, do I want another, it does not appear at the server. No response, nothing.
Here is my code:
Client:
procedure TForm1.FormCreate(Sender: TObject);
begin
TcpClient1.RemotePort := '23';
TcpClient1.RemoteHost := '127.0.0.1';
TcpClient1.Active := True;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
TcpClient1.Active := False;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if TcpClient1.Active then
TcpClient1.Sendln(Edit1.Text)
else
ShowMessage('Connection lost..');
end;
end.
Server:
procedure TForm1.FormCreate(Sender: TObject);
begin
TcpServer1.LocalPort := '23';
TcpServer1.Active := True;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
TcpServer1.Active := False;
end;
procedure TForm1.TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient);
begin
Memo1.Lines.add(ClientSocket.Receiveln);
ShowMessage ('I get data!')
end;
end.
So anybody have comments or suggestions? (I do not ask a complete out of the box solution, I want to get to a higher level ;) )