简体   繁体   English

我可以在具有动态IP的C#中创建套接字服务器吗?

[英]Can I create a socket server in C# that has a dynamic IP?

As far as I know for a socket client to be able to connect to a socket server it needs to know the server's IP address. 据我所知,套接字客户端能够连接到套接字服务器,它需要知道服务器的IP地址。

But what happens when the server is using a dynamic IP address? 但是当服务器使用动态IP地址时会发生什么?

Is it possible to connect to the server in any other way (I don't think so) ? 是否有可能以任何其他方式连接到服务器 (我不这么认为)

Is there a way for me to let the client know the server's IP address automatically? 有没有办法让客户自动知道服务器的IP地址?

Thanks in advance 提前致谢

Is it possible to connect to the server in any other way (I don't think so)? 是否有可能以任何其他方式连接到服务器(我不这么认为)?

You could use a DNS name as well. 您也可以使用DNS名称。 There are some DNS providers which allow you to associate a fixed DNS name to a dynamic IP address. 有一些DNS提供程序允许您将固定DNS名称与动态IP地址相关联。 You may take a look at dyndns . 您可以看看dyndns

Is there a way for me to let the client know the server's IP address automatically? 有没有办法让客户自动知道服务器的IP地址?

The client needs an IP or DNS name. 客户端需要IP或DNS名称。

you may store the dynamic IPs in some static IP data storage. 您可以将动态IP存储在某些静态IP数据存储中。 the client will always know the static IP adress and from there he will take the dynamic adress. 客户端将始终知道静态IP地址,并从那里获取动态地址。

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

相关问题 C#服务器-TCP / IP套接字效率 - C# Server - TCP/IP Socket Efficiency 如何使用 Dynamic IP 请求连接 c# 中的套接字? - How to use Dynamic IP to request connect with socket in c#? c#我可以用streamwriter创建一个动态文件名吗? - c# can i create a dynamic file name with streamwriter? 如何在 C# 中创建动态字符串格式 - How can i create a dynamic string format in C# C#如何通知客户端有关服务器动态IP更新的信息 - C# how to notify clients about server dynamic ip update 如何使用C#确定本地网络上的哪些IP地址是静态/动态的? - How can I use C# to determine which IP addresses on my local network are static/dynamic? 如何从查询中创建 C# 中的“动态”列表,其属性命名为 SQL 服务器表的列 - How can I create a "dynamic" list in C# from query with properties named like columns of a SQL Server table 给定服务器的 IP 地址和端口,如何使用 C# 测试与服务器的 TCP 连接? - How can I test a TCP connection to a server with C# given the server's IP address and port? C#:检查套接字是否与服务器建立活动连接? - C#: Checking if a socket has a active connection to the server? 如何查看C#套接字已排队发送多少字节? - How can I see how many bytes a C# socket has queued to send?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM