Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Client connects to Server from within network, not from outside

 
Michael Baucum
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I made two Java programs: a server and a client. The server uses ServerSocket, and the client uses Socket. The (made-up) IP address in the String "host" below is my IPv4 address.

I instantiate the Socket as follows:


I was able to connect my client to my server from a separate computer on my own network. I'd made an exception in my firewall for port 2222, and I also dug into my router settings and had it forward to port 2222.

PROBLEM: Now, when I keep my Server program running on computer A and I take computer B to ANOTHER network... I get an IOException (see above code for how this is handled). Am I using the wrong kind of IP address? or is there something else besides port forwarding and firewall exceptions I haven't yet accounted for?

Please let me know if you need any more information to help me solve this problem.

Thanks,
Michael
 
Michael Baucum
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a more full listing of the code involved:
















The Client and Server code is what I'm asking about; the rest is there for you to see what I'm going to be doing with it.



If
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Baucum wrote:PROBLEM: Now, when I keep my Server program running on computer A and I take computer B to ANOTHER network... I get an IOException (see above code for how this is handled). Am I using the wrong kind of IP address? or is there something else besides port forwarding and firewall exceptions I haven't yet accounted for?


Yes. The IP address 192.168.0.6 in that other network may or may not exist, but it certainly isn't computer A. Computer A isn't even in that other network.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!