0

I am trying to write a client-server program in Java. There are a lot of working examples with using localhost as IP of the server. I am using VPN and running client and server codes on different computers in same network. But client can not connect to this server when I provide ip given after running VPN (such as 12.123.45.32). I generally get timeout error even if I set it to a large number. But if I use local IP such as 192.168.1.10, it works and connects.

I also wonder if there is a way for client and server to communicate with using server's public IP (without any VPN).

Any suggestions?

Thanks..

oguz
  • 1
  • 1
  • 4
  • Is it possible the vpn is blocking the port your trying to use? (afaik a vpn would be using an external network connection, so its likely ports are blocked). Presumably the vpn allows http/https, so you could try using port 80 or 443. If these computers are on a local network, what's the downside of using the local ip addresses, rather than routing through a vpn? – Robadob Jun 04 '14 at 00:29

1 Answers1

0

There is no problem in accessing a server through public ip or domain name. Only problem can be address renewal. Other than that you need to make sure the correct ports are forwarded in your router / firewall.

Are you using sockets or RMI?

Sockets shouldn't be a problem, but RMI require you to setup a SecurityManager or something like that. Honestly I have never gotten RMI to work over internet; I have stuck with sockets.

I wouldn't bother with VPN at all. Way too unstable imho. I only use VPN if I'm unable to setup company router for access.

andidegn
  • 127
  • 8