Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Client server connection problems.

843790Oct 26 2008 — edited Oct 30 2008
I'm working on a simple IM type program for a friend and me to use. I have the server running on my computer. It works fine for me when I connect the client on my computer, but it won't connect from my friend's computer. I think the problem is because I'm connected to the web through a router. Is there a certain way I should set up the serversocket and client socket? Right now I have something similar to:
server = new ServerSocket(5555, 100, InetAddress.getByName("10.0.0.2"));
and
clientSocket = new Socket(InetAddress.getByName(serverAddress),  SocketMessengerConstants.SERVER_PORT, InetAddress.getByName("10.0.0.2"), 5555);
where serverAddress is the IP address to my router and SERVER_PORT is the port on the router that is set to send to my computer. My thinking is that the server is listening on 10.0.0.2, which is IP address for my computer on the network and is listening on 5555. The client has to go through the router, so it first goes to serverAddress on SERVER_PORT. From the router it should send to 10.0.0.2 on port 5555.

I'm fairly new to networking, so I'm probably overlooking something simple. Also, I have already set the firewalls to work allow the port exceptions. At least I'm pretty sure I've set them up correctly. Any help would be greatly appreciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 27 2008
Added on Oct 26 2008
3 comments
247 views