Java: Using server to create P2P between two clients

Deadly 提交于 2019-12-08 06:29:53

问题


I am experimenting with a file transfer program in Java and I wanted to create a server that would handle creating P2P connection between two clients.

Don't know how that should work, exchanging sockets? I don't want to exchange IP address... Seen some questions similar (ev. Connecting two clients via server java) but I have no idea how to achieve that. Thanks for your time


回答1:


It sounds like you are looking for nat traversal techniques. There is no single solution because there are many different network setups. Most p2p software employs a combination of different solutions, such as using IPv6 where available, negotiating with home routers and operating system firewalls or NAT hole punching. Servers can assist in the last point.



来源:https://stackoverflow.com/questions/48508281/java-using-server-to-create-p2p-between-two-clients

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