Is this on one computer or two?
this line...
1
| socket = new Socket(InetAddress.getLocalHost(), 4444); |
Will make a connection on port 4444 to the machine that this code is running on. If your servre is running ona differnt machine, you wont get there this way.
If this is all on the same machine, how many internet connections does the machine have? if it has two or more then you may have to do more work to insure that the client and server are talkign on the same connection. The ebst thing to do in that case is to explicitly state "127.0.0.1" for both the IP for both server socket and the client socket.
Finally, turn off your local firewall. Under windows this will be in your security control panel. It gets in the way of a lot of networking. if this solves it, you can then go into the settings for the firewall and open the necessary prots so you can trun it back on.
these are two standalone classes/apps
i run then on 1 pc with only 1 connection
port 4444 is open in my router so it should work, dont see why
maybe windows firewall will try it later