开发者

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

开发者 https://www.devze.com 2022-12-25 13:48 出处:网络
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 lo

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开发者_JS百科, 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号