即使IP地址发生更改,主机之间的持久TCP连接 [英] Persistent TCP connection between hosts, even if IP address changes

查看:86
本文介绍了即使IP地址发生更改,主机之间的持久TCP连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使IP地址发生更改,如何与另一个远程主机建立持久的TCP连接?

How can I have a persistent TCP connection to another remote host, even when IP address changes?

说我创建了一个程序来连接到IP地址.过了一会儿(PC重新启动等),IP地址更改,我的程序不再连接到目标PC.

Say I create a program to connect to an IP address. After a while (PC restart, etc) the IP address changes and my program wont connect to the target PC anymore.

存在一个称为DNS的东西,您可以在其中键入域,然后您将获得有效的IP地址.为此,我听说您需要托管服务器并为此付费.

There exists something called DNS where you can type a domain and you will get back a valid IP address. For that I hear you need to host a server and pay for that.

例如,Skype是P2P.怎么运作的?

Skype for example is P2P. How does that work?

是否有一种方法可以使我的服务器(即使不在我的本地局域网中)可以始终连接到服务器,即使我的IP地址发生了变化?

Is there a way to programmatically make a server that someone (who is NOT in my local lan) can always connect to, even if my IP address changes?

推荐答案

即使机器的地址发生更改,也可以使用p2p命名机制连接到机器. Microsoft提供了PNRP名称服务,该服务使用p2p命名系统为计算机生成唯一名称.使用此PNRP名称,即使机器的IP地址更改后,也可以连接到该机器.检查以下链接上的详细信息: https://technet.microsoft.com/en-us/library/bb962088.aspx

You can use p2p naming mechanism to connect to a machine even after its address changes. Microsoft has PNRP name service which uses p2p naming system to generate a unique name to a computer. Using this PNRP name, you can connect to the machine even after its IP address changes. Check the below link on the details: https://technet.microsoft.com/en-us/library/bb962088.aspx

Skype也可能使用类似的机制来标识其他对等地址.

Skype might also be using similar mechanism to identify the other peers address.

这篇关于即使IP地址发生更改,主机之间的持久TCP连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆