Visit Our UNIX and Linux User Community

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

Thread Tools Search this Thread
Top Forums Programming Error: No Route to host...urgent {socket() connection}
# 1  
Old 10-29-2007
Error: No Route to host...urgent {socket() connection}


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 i.e server ip its working fine...

and when using telnet...[root@localhost /]# telnet
telnet: connect to address 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
# 2  
Old 10-29-2007
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.
# 3  
Old 10-29-2007
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.
# 4  
Old 10-30-2007
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
# 5  
Old 10-30-2007
As porter said that disabling firewall solves the problem of socket connection with the I mentioned in my 1st post....

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

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

So why connection refused here.....?????????
can anybody help me????
# 6  
Old 10-30-2007
Originally Posted by arunchaudhary19
As porter said that disabling firewall solves the problem of socket connection with the server
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.
# 7  
Old 10-30-2007
Originally Posted by blowtorch
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.

Previous Thread | Next Thread
Test Your Knowledge in Computers #16
Difficulty: Easy
There are a total of 25 pins in the traditional parallel port of a computer system.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Telnet error- Escape character is '^]' and connection closed by foreign host

In program, I want to telnet the ports present in telnet.txt file and capture screenshot of open port which is opened on new terminal. Problems: Escape character is '^]' and Connection closed by foreign host. Loop is not working properly. It only take one ports and closed the connection. ... (9 Replies)
Discussion started by: sk151993
9 Replies

2. Red Hat

Connection closed by host error in rhel 6 Linux

Hi All, I am new to Redhat Enterprise Linux 6 version. I am facing an issue with my lab server which is having RHEL6 lab1:root> uname -a Linux lab1 2.6.32-358.18.1.el6.x86_64 #1 SMP Fri Aug 2 17:04:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux I am getting this error for every 18 minutes 30... (0 Replies)
Discussion started by: go2suresh1979
0 Replies

3. UNIX for Advanced & Expert Users

"Network error: No route to host" While connecting guest RHEL4 using putty

Hi, I have installed RHEL4 using vmware workstation.. Host OS: Windows XP Guest OS: RHEL4 Pls refer step 17 & 18 in below link... ORACLE-BASE - Red Hat Enterprise Linux 4 and Centos 4 Installation 1) If i choose to assign IP automatically (using DHCP) means, i am able to connect RHEL4... (3 Replies)
Discussion started by: thomasraj87
3 Replies

4. UNIX for Dummies Questions & Answers

No route to host - mail error

A linux box is supposed to emailing the results of backups to the windows exchange server, but nothing arrives. it never has, as the muppet who set up the Windows domain knew nothing about linux. I know only slightly more than that... pretty sure sendmail is the daemon running to handle mail. it... (0 Replies)
Discussion started by: Noewon
0 Replies

5. IP Networking

IP forwarding Route/Host ?

I have a unix machine that operates some CNC machines, I need to hook up my windows machine through core ftp to load programs onto the box. The card i need to route to for the FTP on unix is tu1 I need to check the routing tables on the unix box to see which IP address will automatically... (2 Replies)
Discussion started by: moticulus
2 Replies

6. AIX

problem with host route

Hi, I have a system with network interfaces en0 and en1 en0: physical ip: virtual ip1: virtual ip2: en1: physical ip: virtual ip1: virtual ip2: default gateway ist when I open a... (12 Replies)
Discussion started by: funksen
12 Replies

7. Programming

socket() No Route to host ??

Hello, My program should connect to a server. here's the code : int main(int argc, char *argv){ int sock = socket(AF_INET, SOCK_STREAM, 0); if(sock == -1){ perror("socket()"); exit(errno); } printf("retour socket = %d",sock); struct sockaddr... (1 Reply)
Discussion started by: nowayy
1 Replies

8. Red Hat

No route to host

I get below error when using telnet and ssh ?? Why ? the ip address of linux server is =tstgcota ?? # netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface U 0 0... (6 Replies)
Discussion started by: chuikingman
6 Replies

9. UNIX for Dummies Questions & Answers

no route to host

I not able to ping outside the internet. i am able to ping my 192. ip address. when i try to ping a 68. ip address i get no route to host. what should i do to correct this issue. I have sco openserver 5.05 (6 Replies)
Discussion started by: scoman2
6 Replies

10. UNIX for Dummies Questions & Answers

add route gives target: Host name lookup failure

We need to add our remote office to our linux routing table. Our internal office ip addresses are all in the range of 198.9.200.x with an subnet mask of the remote office has ip addresses in the range of and also a subnet mask of when i use the... (3 Replies)
Discussion started by: progressdll
3 Replies

Featured Tech Videos