让网络上的客户端发现服务器 [英] Get clients on the network discover the server
问题描述
我目前正在编写一个使用TCP / IP进行通信的Java应用程序。我想要完成的是让客户端轻松找到服务器并通过发送一些消息进行连接。
I'm currently writing a Java application that uses TCP/IP to communicate. What i'm trying to accomplish is to get the client to easy find the server and connect by sending some message out.
现在的问题是:
什么我可以做客户端发现服务器吗?
The question now is: What can i do to make the client discover the server?
有没有办法可以向路由器发送消息(可能是DHCP服务器)告诉它我'我用这个服务?然后客户端可以检查路由器(DHCP服务器)上是否有类似的东西并连接到相应的IP。
Is there a way i can send a message to the router (DHCP-server maybe) that tells it that I'm using this service? Then the client could check if there is anything like that on the router (DHCP-server) and connect to the appropriate IP.
希望有人可以提供帮助。
Hopefully someone can help.
推荐答案
您可以使用UDP广播。这里有关实施的一些细节。
You can use UDP broadcast. Here some details about implementation.
这篇关于让网络上的客户端发现服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!