Results 1 to 8 of 8
  1. #1
    lse123 is offline Senior Member
    Join Date
    Oct 2008
    Posts
    116
    Rep Power
    0

    Default Server is in a network using an IP, but router in network carries the external IP(www

    I modified a server/client chat App from ch24, Java HTP7 DEITEL, well If I want to connect to Server from client, and Server is in a network using an IP, but router in network carries the external IP(www), then what IP to use to connect? the router's?

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    I don't know what ch24, Java HTP7 DEITEL is, but I'm fairly certain you just want the server's IP address. The router should NAT that for you, and it should all be transparent to your program. I'm trying to think of a possible exception to that rule, but it would be so strange that I would need to see it to believe it.

    -Gary-

  3. #3
    lse123 is offline Senior Member
    Join Date
    Oct 2008
    Posts
    116
    Rep Power
    0

    Default other pcs in that network of server, must not run this simple educational app... only

    TEXTBOOK IS HOW TO PROGRAM , DEITEL...

    if router is in one PC and the server is connected to that router/PC then I must use the router's IP? Also other pcs in that network of server, must not run this simple educational app... only one PC must run it?

  4. #4
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Quote Originally Posted by lse123 View Post
    TEXTBOOK IS HOW TO PROGRAM , DEITEL...

    if router is in one PC and the server is connected to that router/PC then I must use the router's IP? Also other pcs in that network of server, must not run this simple educational app... only one PC must run it?
    No, I'm pretty sure I said the opposite. Use the server's IP address. The IP layer knows that if the server is not on the local network, it needs to send the packet to the router -- your application does not get involved in that. Your application simply requests a connection to the server.

    For most services, it is no problem if multiple machines on the same network run it, as the clients know which server they want to connect to. There are a few exceptions, notably DHCP, which respond to broadcast requests, so you have to be careful about more than one machine on a network running the service. In the case of DHCP you either make sure only one machine is running the service, or you make sure that all machines running DHCP share a synchronized database. But this almost certainly does not apply to your situation.

    -Gary-

  5. #5
    lse123 is offline Senior Member
    Join Date
    Oct 2008
    Posts
    116
    Rep Power
    0

    Default

    I mean if server is in home network, and has same as router IP, like 3 other PCs on the same network(is not router PC), and make differ THE TOTAL 4 PCs, from second IP (from those kept internally networks - not outer internet) ?

  6. #6
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    If I am understanding you correctly, then in that configuration you would need to set up port forwarding on the router -- and this is outside the scope of a Java forum.

    -Gary-

  7. #7
    lse123 is offline Senior Member
    Join Date
    Oct 2008
    Posts
    116
    Rep Power
    0

    Default

    normally in a HOME NETWORK, Router has one external IP, and other PCs have the same plus one internal IP to distiguish between? correct?

  8. #8
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Quote Originally Posted by lse123 View Post
    normally in a HOME NETWORK, Router has one external IP, and other PCs have the same plus one internal IP to distiguish between? correct?
    Again, this is outside the scope of a Java forum. A common configuration for home or business networks has a firewalling router using Network Address Translation (NAT) to share its Internet IP address(es) among a number of internal hosts. For instance you might have:

    Java Code:
        Router/firewall external IP: 66.102.7.99
        Router/firewall internal IP: 192.168.1.1
    
        PC1 internal IP: 192.168.1.11
        PC2 internal IP: 192.168.1.12
        PC3 internal IP: 192.168.1.13
    If you had a network configured like this, and you wanted to run a service on PC3 (say on port 8080) and make it available to the public Internet, you would need to configure port forwarding on the Router/firewall. You need to tell the Router/firewall that requests for connections on port 8080 should be forwarded to address 192.168.1.13. Then you would tell the clients on the Internet to connect to port 8080 on 66.102.7.99.

    -Gary-

Similar Threads

  1. network problem (if anyone can try this)
    By skandalouz in forum Networking
    Replies: 1
    Last Post: 12-23-2009, 11:45 AM
  2. Sending a key over network
    By cst in forum Networking
    Replies: 0
    Last Post: 11-04-2009, 02:19 PM
  3. detecting mail server in network
    By iqcst in forum Networking
    Replies: 4
    Last Post: 11-26-2008, 08:49 AM
  4. Monitoring the network
    By khajalid in forum New To Java
    Replies: 4
    Last Post: 09-10-2008, 02:55 PM
  5. Monitoring the network
    By khajalid in forum Networking
    Replies: 3
    Last Post: 09-10-2008, 02:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •