英文:
How to avoid to have to set port forwarding
问题
我正在用Java编写一个程序,它允许发送文件的丰富客户端。
因此,从具有公共IP(称为pip1)的LAN 1,第一个丰富客户端(fc1)具有本地IP(lip1),将文件通过WAN发送到LAN 2上的第二个丰富客户端(fc2)(pip2)。
我使用TCP/IP协议在端口8081上进行通信。因此,只有在LAN1的路由器上为lip1转发端口8081,并且在LAN2的路由器上为lip2转发端口8081,它才能正常工作...
这实在太糟糕了:我想你已经明白我在网络方面不太擅长。:s
您有什么建议吗?我正在使用java.net.ServerSocket。
英文:
I'm programming a fat client in Java that permits sending files.
So from LAN 1 with public IP (so called pip1), a first fat client (fc1) with local IP (lip1) sends a file to a second fat client (fc2) on LAN 2 (pip2) via WAN.
I use the protocol TCP/IP on port 8081. So it is working only if I port-forward the port 8081 for lip1 on LAN1's router and with the port 8081 for lip2 on LAN2's router...
It is awful: I guess you have understood I'm not good with network stuff. :s
What is your suggestion? I use java.net.ServerSocket
答案1
得分: 0
嗯,我想我在这个主题上的研究还不够。:s 我在这里找到了许多想法:
-
这完全与NAT-T有关,涉及诸如UPnP、ICE、PMP或PCP等协议。
-
https://stackoverflow.com/questions/30367603/connecting-p2p-over-nat<br>
<br>
还有许多与关键词“P2P、JAVA、NAT”相关的内容。感谢Marquis of Lorme让我找到了方向。
英文:
Hmm, I guess I didn't research enough on the topic. :s I have found many ideas here:
-
it is all about NAT-T, with protocols like UPnP, ICE, PMP or PCP
-
https://stackoverflow.com/questions/30367603/connecting-p2p-over-nat<br>
<br>
And many others with the keywords "P2P, JAVA, NAT". Thanks to Marquis of Lorme by launching me on the track.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论