The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Session PID & socket connection pid pcx26 UNIX for Dummies Questions & Answers 1 03-30-2006 09:06 AM
no route to host scoman2 UNIX for Dummies Questions & Answers 6 08-30-2004 04:58 AM
Killing host connection saabir Linux 5 03-26-2004 06:32 PM
add route gives target: Host name lookup failure progressdll UNIX for Dummies Questions & Answers 3 08-07-2002 08:01 AM
connection to host lost nbiketi UNIX for Dummies Questions & Answers 1 04-25-2001 08:45 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-29-2007
Registered User
 

Join Date: Sep 2007
Posts: 62
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
Reply With Quote
Forum Sponsor
  #2  
Old 10-29-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,327
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.
Reply With Quote
  #3  
Old 10-29-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
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.
Reply With Quote
  #4  
Old 10-30-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,327
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
Reply With Quote
  #5  
Old 10-30-2007
Registered User
 

Join Date: Sep 2007
Posts: 62
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????
Reply With Quote
  #6  
Old 10-30-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,327
Quote:
Originally Posted by arunchaudhary19 View Post
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.
Reply With Quote
  #7  
Old 10-30-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by blowtorch View Post
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:57 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0