如何从外部访问我的 PC 上运行的 Java servlet?
我使用Netbeans6.7编写了一个servlet,当它运行时,它会打开一个浏览器窗口,地址为: http:// /localhost:8080/My_App/Test_Servlet,我用我的 IP 地址替换了“localhost”,现在它看起来像这样: http://192.???.1.??:8080/My_App/Test_Servlet,但我尝试从家外的另一台计算机访问它,它无法读取任何内容,我想知道是否需要更改 Windows 防火墙设置以允许外部流量,它是 Paypal IPN 应用程序,所以我致电 Paypal,他们说他们无法访问: http://192.???.1.??:8080/My_App/Test_Servlet
我应该怎么做才能允许来自“paypal.com”的流量访问“My_App/Test_Servlet”?
部分成功!在我阅读文章、设置静态 IP、端口转发后,我可以从 Paypal 的测试 IPN 页面发送一条消息,当我尝试发送第二条消息时,它无法通过,所以我停止启动我的 servlet,然后我可以再发一条消息,第二条又失败了,为什么? 坦率
I used Netbeans6.7 to write a servlet, when it runs, it opens a browser window with this address : http://localhost:8080/My_App/Test_Servlet, I replaced the "localhost" with my IP address, now it looks like this : http://192.???.1.??:8080/My_App/Test_Servlet, but I tried to access it from another computer outside my home, it can't read anything, I wonder if I need to change Windows Fire Wall setting to allow outside traffic, it's a Paypal IPN app, so I call Paypal, they said they can't access : http://192.???.1.??:8080/My_App/Test_Servlet
What on my side should I do to allow traffic from "paypal.com" to access "My_App/Test_Servlet" ?
Partial success ! After I read the articles, set up static IP, port forwaring, I can send one message from Paypal's test IPN page, when I tried to send a second one it couldn't go through, so I stop started my servlet, then I could send another ONE, message, failed again on the 2nd one, why ?
Frank
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我无法决定是否将其投票给 serverfault.com 还是 superuser.com,所以哎呀,我在这里回答:
您引用的 IP 地址看起来像本地地址(192.168.xx 是本地范围之一) ,例如),因此永远无法从网络外部访问该地址。这是您的路由器(或调制解调器)分配给您的地址。
要允许从外部世界到您的 PC 的呼叫:
不要让这看起来令人畏惧。这很重要,但并不难。但请注意,一旦您告诉路由器将端口转发给您,您就绕过了路由器可能提供的针对计算机攻击的大部分或全部保护(在该端口上;通常是攻击者端口扫描) 。它可能不提供任何,但它可能提供一些。
I couldn't decide whether to vote this over to serverfault.com or superuser.com, so heck, I'm answering here:
The IP address you've quoted looks like a local address (192.168.x.x is one of the local ranges, for instance), so that address is never accessible from outside your network. That's an address your router (or modem) has assigned to you.
To allow a call from the outside world to your PC:
Don't let that seem daunting. This is non-trivial, but not hard. Do note, though, that as soon as you tell your router to forward a port to you, you bypass most or all of whatever protection your router may be providing against attacks on your computer (on that port; and usually attackers port-scan). It may not be providing any, but it may be providing some.
无法从外部访问您的本地 PC 上的应用程序。其一,您的 IP 地址不是静态的。当它到达您的互联网云服务提供商时,您将拥有另一个 IP 地址。
更好的解释(来自 http://portforward.com/help/portforwarding.htm):
唯一可以帮助您的解决方案是端口转发。请参阅此处以端口转发您的路由器。
There's no way of accessing your application from the outside to your local PC. For one, your IP address isn't static. By the time it reaches your Service provider to the Internet cloud, you would have had another IP address.
A better explanation (from http://portforward.com/help/portforwarding.htm):
The only solution that can help you is to Port Forward. See here to port forward your router.
您必须将路由器配置为将端口 8080 端口转发到您的 PC,并在您提供给 Paypal 的 URL 中使用路由器的外部 IP 地址。
请参阅 portfward.com。
You'll have to configure your router to port forward port 8080 to your PC and use your router's external IP address in the URL you give to Paypal.
See portfward.com.