简体   繁体   English

indy Tcp连接

[英]indy Tcp Connection

iam trying to test my application to public network so i will use my own ip as server , i already did port forward in my router settings, " my goal is reach this application to computers out side my network " but i only can receive data i cannot send from my main ip to other computer ,, i have disabled my firewall also the other pc firewall is this problem of my router ? 我试图在公共网络上测试我的应用程序,所以我将使用自己的IP作为服务器,我已经在路由器设置中进行了端口转发,“我的目标是将该应用程序连接到网络之外的计算机上”,但我只能接收数据无法从我的主IP发送到其他计算机,我禁用了我的防火墙,也禁用了其他PC防火墙,这是我的路由器的问题吗? or my network ? 还是我的网络? i tried to disable router firewall but still same problem is there other things i have to check ? 我试图禁用路由器防火墙,但仍然存在相同的问题,我还需要检查其他内容吗? also i set my indtCP server binding to 0.0.0.0 to reach all network. 我也将我的indtCP服务器绑定设置为0.0.0.0,以访问所有网络。

You should be able to send, but only after the client connects to your server. 您应该能够发送,但仅客户端连接到服务器之后才能发送。

When a client connects you should handle OnConnect event of your TIdTCPServer component. 当客户端连接时,您应该处理TIdTCPServer组件的OnConnect事件。 AThread parameter represent your client. AThread参数代表您的客户端。 You can respond to it by, for example: 您可以通过以下方式对此做出回应:

AThread.Connection.Write ('Hi!');

You can disconnect the client by: 您可以通过以下方式断开客户端连接:

AThread.Connection.Disconnect;

Of course, many clients can be connected at the same time. 当然,可以同时连接许多客户端。 In this case, you should keep track on all (dis)connected clients. 在这种情况下,您应该跟踪所有(断开连接)的客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM