How to access Java servlet running on my PC from outside?

十年热恋 提交于 2019-12-05 18:45:50

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:

  • Your PC needs to be on any time you're expecting one of the calls (and if it's a PayPal IPN, that's pretty much always)
  • You have to have a static IP address for your internet connection, or use a dynamic DNS service
  • You have to give PayPal the static IP address of your internet connection (not your PC's internal one) or the DNS name you have set up with the dynamic service
  • You have to configure your router to forward requests to your static, public address to your computer (since your router probably supports multiple computers and needs to know which specific one should handle the request)
  • If you use a software firewall such as Windows Firewall, you'll have to tell it that it can accept requests on that port.

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.

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):

1.) Every device on the internet has at least one ip address. The IP address is a number that is used to identify a device. For more information on ip addresses refer to our What is an IP Address page.

2.) Every IP address is divided up into many ports. When one computer sends data to another computer, it sends it from a port on an ip address to a port on an ip address.

3.) A port can only be used by one program at a time.

The only solution that can help you is to Port Forward. See here to port forward your router.

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.

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