[英]Java Connect Over A Socket Using Public IP Address
I'm basically trying to connect to other computer. 我基本上是想连接到其他计算机。 Everything works as I want once I use "localhost" as the IP address.
一旦使用“ localhost”作为IP地址,一切都会按我的意愿进行。 If I try to put in my public IP, my client cannot find the server running although it is.
如果我尝试放入公共IP,则客户端无法找到正在运行的服务器。 If I switch it to "localhost" it works again.
如果我将其切换为“ localhost”,它将再次起作用。
I'm using a router or a modem or how do you call these things to split internet for 4 people + wireless. 我正在使用路由器或调制解调器,或者您如何称这些东西来为4个人+无线网络拆分互联网。 I have my port forwarded, but I still can't get it to work.
我已经转发了端口,但是仍然无法正常工作。 What are the problems I might be encountering?
我可能会遇到什么问题? I don't think this is the problem with the code since everything works properly with "localhost", unless I need to do something extra when switching to public IP.
我认为这不是代码的问题,因为一切都可以在“ localhost”下正常运行,除非在切换到公共IP时需要做一些额外的事情。
I also tried to disable firewall and it still didn't work. 我也尝试禁用防火墙,但仍然无法正常工作。 When I checked what is my IP address it is said that my IP is static, but I don't see the difference.
当我检查我的IP地址是什么时,它说我的IP是静态的,但是我看不出有什么区别。
Any thoughts/ideas are much appreciated. 任何想法/想法都非常感谢。
There are two possible problems I can think of: 我可以想到两个可能的问题:
I have found my problem. 我发现了我的问题。 I was doing everything correctly.
我做的一切正确。 And everything works correctly.
一切正常。 The problem is that my router can't connect to itself using my static(external/public) IP.
问题是我的路由器无法使用我的静态(外部/公共)IP连接到自身。 Other people can connect to my external/public IP properly.
其他人可以正确连接到我的外部/公共IP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.