I have 2 computers on a local network with a router. I installed NetBeans and JDK on both computers and successfully ran the Client/Server KnockKnock tutorial, which uses the socket class.
My client (MyCPU) uses the following line to create a new Socket object to connect to the server (Kim-PC):
I want to try to get it working across the internet now instead of just on my local network.
kkSocket = new Socket("KIM-PC", 62571);
Since both computers share the same IP Address, can I use the Socket class as follows?
which would translate on my system to...
Socket(String host, int port, InetAddress localAddr, int localPort)
*where xxx.xxx.xxx.xxx = my IP address
Socket("KIM-PC", 62571, xxx.xxx.xxx.xxx, int localPort)
If so, what is the localPort?