How to find my server in LAN?

时光毁灭记忆、已成空白 提交于 2019-12-04 01:48:55

问题


I have two my own applications on C++ and Java: server and client. It both in one LAN and can transfer data via specified port. I want to make it possible, that client can find IP of server. But how to? Enumeration of all possible IP with address mask - bad idea, it will take a lot of time. May be exists some way, where I can send broadcast to lan from client and receive it in server? Or another way... I can't find information about this, but I think that is possible, because I see it in MyPhoneExplorer on android, for example.


回答1:


Why not using UDP broadcast? the client can UDP broadcast "I am at x.x.x.x", and the server can answer (in UDP) to the client, "I am at y.y.y.y".




回答2:


maybe you can use the Broadcast Address to find your server.



来源:https://stackoverflow.com/questions/12520998/how-to-find-my-server-in-lan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!