Home > Back-end >  About Delphi idtcpserver and idtcpclient problem.
About Delphi idtcpserver and idtcpclient problem.

Time:11-15

Ask, I want to use idtcpserver and idtcpclient, connected the android tablet to the computer, can send and receive messages, the idea is to tablet as the client, the computer as a server,
But the link has been link failure, shown as: the connection timeout,

Tablet (client) code:
Procedure TForm1. Button1Click (Sender: TObject);//used to configure the host and port, and link
The begin
IdTCPClient1. Host:='141.55.217.203';//this is a server IP address
IdTCPClient1. Port:=1339;
IdTCPClient1. Conect;
end;

Procedure Tform1. IdTCPClient1Connected (Sender: TObject);
The begin
Memo1. Lines. The Add (idtcpclient1. Socket. ReadLn);
end;

end;

PC (server) code:
Procedure TForm1. Button1Click (Sender: TObject);//used to configure the port, and activated, equivalent to the initialization,
The begin
IdTCPServer1. DefaultPort:=1339;
IdTCPServer1. Active:=True;
end;

Procedure Tform1. IdTCPServer1Connect (Sender: TObject);
The begin
Acontext. Contection. Socket. WriteLn (" connected ");
Memo1. Lines. The Add (' connecting.. ');
end;

end;

The code above hope running result: PC enabled, flat link, link after success, received the news of the connected tablet, PC display connecting message,

Ps. PC firewall has been checked, should be no problem,
Two devices are in the same local area net,
Tablet is FMX environment, PC is the VCL environment, compile software for RAD10.2,
But always show the connection timeout, excuse me, is what went wrong,
  • Related