Results 1 to 10 of 10
  1. #1
    java_muggers is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Default clients cannot connect to server on another machine

    Hello
    I have written server/client programs in java. When i 'm executing my server and client on the same machine then , my client program can easily be connected to the server on the same machine , but when Server is running on one machine and client on another machine , client cannot connect to the server and creates an Exception that "No route to host".
    I've tried with disabling the firewall and changing the port , but still the problem persists.

    Anybody suggestions are welcomed...

  2. #2
    berkeleybross's Avatar
    berkeleybross is offline Senior Member
    Join Date
    Feb 2010
    Location
    England
    Posts
    187
    Rep Power
    5

    Default

    Are you using IP addresses or computer names?

    Can you ping the server from the host?

  3. #3
    HerrK. is offline Member
    Join Date
    Jun 2010
    Location
    Berlin
    Posts
    22
    Rep Power
    0

    Default

    Maybe you should check the network settings. If the client doesn't have a route to the server, there are some reasons:

    First of all, as mentioned by berkeleybross, you might use a name that could not be resolved (try the ip address instead).
    But while the system says that a route is missing, you might check if the ip addresses are in the same subnet. Let's assume that the client has the address 192.168.1.1 and the server has 192.168.2.1, than the subnet 255.255.0.0 will do fine while 255.255.255.0 wont work. So the subnetmask defines which part of the ip address is part of the same subnet. If you try to connect to a address inside the same subnet, a broadcast will be send to each client of the subnet. If you want to address some address outside the subnet, the request will be send to the gateway (a router) which has to know how to route the package.

    If you have two different subnets and can't change these settings, you could setup a route (just check the route command, which should be available on most OS)

  4. #4
    java_muggers is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Default

    @berkeleybross: yes, I'm using IP address of the server and also server is pinging from the client machine.

    @HerrK.: yes my server and client is on the same subnet .....my server ip is 172.16.40.204 and client machine's IP is 172.16.40.204...but client cannot connect the server.

  5. #5
    HerrK. is offline Member
    Join Date
    Jun 2010
    Location
    Berlin
    Posts
    22
    Rep Power
    0

    Default

    If the both machines have the same ip address, you can't differ them and so not contact either one of them.

    If your client wants to connect to the server, it will check the target ip. If the target ip is assigned to one network interface of the client itself, a loopback connection will be used. If the ip address is inside the subnet of the client, a broadcast will be used to connect the target. Otherwise the client will lookup the local routing table for a route to the host and if none exists using the std. gateway.

    Just ensure, that the client and the server use the same subnet, but different IPs. And by the way, the class C net 192.168.0.0/16 (255.255.0.0) is private (which mean no internet address), better use addresses of this network, while you wont get in conflict with existing websites.

  6. #6
    java_muggers is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Default

    @HerrK.: Sorry My server is on 172.16.40.204 and the client is on the machine having 172.16.40.203 its IP.

  7. #7
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    952
    Rep Power
    5

    Default

    Quote Originally Posted by HerrK. View Post
    And by the way, the class C net 192.168.0.0/16 (255.255.0.0) is private (which mean no internet address), better use addresses of this network, while you wont get in conflict with existing websites.
    Actually, all 255 Class C networks from 192.168.0.0/24 to 192.168.255.0/24 are private. So are the 16 Class B networks from 172.16.0.0/16 to 172.31.0.0/16 and the single Class A network 10.0.0.0/8. OP is fine with his 172.16 network.

    If you can ping from one machine to the other, the only thing left is software firewall issues. Make sure you are not blocking traffic on the port you are trying to use. (Also make sure the client really is using the server's IP address, and not its own.)

    -Gary-

  8. #8
    java_muggers is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Default

    @gcalvin: yeah i've tried the excution of client and server with disabling the firewall at both of the machines ,,,,,but problem is still there....

  9. #9
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    952
    Rep Power
    5

    Default

    Quote Originally Posted by java_muggers View Post
    @gcalvin: yeah i've tried the excution of client and server with disabling the firewall at both of the machines ,,,,,but problem is still there....
    Have you tried telnet <server_ip> <port_number>? And do you know for sure that the server process is running?

    -Gary-

  10. #10
    java_muggers is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Default

    The problem is solved ....
    Actually there was a problem with SE Linux Management enabled in Fedora 13 on which the server is running and because that property enabled, it wasn't allowing the clients to connect to the server....
    But when I disabled the System Default Enforcing Mode in SE Linux Management , clients can easily be connected...............

    Thanks for all the suggestions
    :)

Similar Threads

  1. how to connect a server to multiple clients?
    By azhar in forum Networking
    Replies: 15
    Last Post: 03-22-2010, 01:54 PM
  2. Replies: 4
    Last Post: 02-02-2009, 05:05 PM
  3. multi clients connect to udp server
    By bachma7 in forum Networking
    Replies: 5
    Last Post: 12-12-2008, 09:56 PM
  4. SSL Server with authentication of clients
    By zoltan in forum Networking
    Replies: 0
    Last Post: 10-15-2008, 12:27 AM
  5. blocked between server and clients
    By ibtehal in forum Networking
    Replies: 6
    Last Post: 07-17-2008, 01:30 AM

Tags for this Thread

Posting Permissions

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