Sockets - from LAN to online
I have worked with java for 3 years now and I just started networking yesterday. I got a fully working chat program up using sockets. It works fine between computers on a LAN but how do I get it to connect via the internet? InetAddress.getLocalHost() returns my LAN IP, and over the internet, socket creation throws an IOException using when tried with the server's internal or external. Can sockets be used online? How?
# 1
> Can sockets be used online?
Sure...
> InetAddress.getLocalHost() returns my LAN IP
Cause you are under a Lan.....
If you want to use this program on internet, you will need a public IP, to your server program, this way the clients will be available to find the server program.
The clients don't need a public IP, cause they will connect with your server...
So, only you server IP:Port need to be known and public.
# 4
Can you ping the public IP address from that client?
If not, you have a problem. If the internal clients can't use the public IP address you will have to arrange for them to use the internal IP address of the server. Obviously the outside clients still have to use the public IP address.
ejpa at 2007-7-28 18:59:21 >
