Error: No Route to host...urgent {socket() connection}

hello,

I am doing Socket programming..
when I am establishing a socket connection using TCP protocol ...I am getting
Error :: No route to host. at the client side during connect() call...........that it is returning -1.
So I thing problem lies here......but what to do now...

So for just checking the connection I am tried with ping and telnet:::

when I am doing ping 192.9.100.113.......... i.e server ip its working fine...

and when using telnet...[root@localhost /]# telnet 192.9.100.113
Trying 192.9.100.113...
telnet: connect to address 192.9.100.113: No route to host
telnet: Unable to connect to remote host: No route to host..

then also same problem

So, where is the problem and how to solve it.....please tell me in detail....

thanks & regards

No route to host means that there is no connection between your network and the host that you are trying to reach (none that the routers know about, at least). Run traceroute and see where it stops. Then you can either talk to the network admins that handle the router or (if you are the network admin) try to figure out why it isn't able to go ahead.

Here ping (ICMP) is working, but not telnet which makes me think of a firewall blocking port 23. However that normally silently drops packets or returns ECONNREFUSED.

I missed that ping bit, but the error that the OP is getting isn't what should be returned if there is firewall blocking. Like porter said, telnet should quit with "connection refused" kind of error.

And I have another question, what ping command are you running? I have seen the Solaris ping command return "is alive" when run like this:

ping server-x
server-x is alive

But the command has failed when run like this:

ping -s server-x
:
no output - while it actually should throw:

64 bytes from server-x (x.x.x.x): icmp_seq=0. time=0.285 ms
64 bytes from server-x (x.x.x.x): icmp_seq=1. time=0.243 ms

As porter said that disabling firewall solves the problem of socket connection with the server..as I mentioned in my 1st post....

I had checked what blowtorch said in reply.....in my fedora core 6
but I found that its working correctly....
here is my output ...withour error.....
[root@arun ~]# ping -s 10 192.9.100.113
PING 192.9.100.113 (192.9.100.113) 10(38) bytes of data.
18 bytes from 192.9.100.113: icmp_seq=1 ttl=64 time=5.40 ms
18 bytes from 192.9.100.113: icmp_seq=2 ttl=64 time=0.465 ms

Also i tried for telnet......and here is the output for that....
[root@arun ~]# telnet 192.9.100.113
Trying 192.9.100.113...
telnet: connect to address 192.9.100.113: Connection refused
telnet: Unable to connect to remote host: Connection refused

So why connection refused here.....?????????
can anybody help me????

Ok, so we've established that there is no routing problem here. But now I am confused! You said that disabling the firewall solves the problem of socket connection. Then work with the firewall disabled (or better, allow access to your host to access the server, while still blocking other connections). Are you looking for a way to connect even if the firewall is blocking? I'm afraid that's not possible.

Alternatively change the firewall rules. That depends on whether it's permitted etc in your environment.