aspose file tools*
The moose likes Linux / UNIX and the fly likes Not able to telnet to 9922 port Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Not able to telnet to 9922 port" Watch "Not able to telnet to 9922 port" New topic
Author

Not able to telnet to 9922 port

Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 247

Hi All,

I am using RHEL 5.1 and am facing one problem.
when i do a netstat -an | grep 9922

its showing (hostname):9922 LISTEN

but when i telnet as
telnet localhost 9922

its showing me

But when am telneting to the same hostname its connecting.

telent hostname 9922

its connecting
and showing connected.

My question is why am not able to use localhost instead of actual host name if am doing telnet from the same machine.

I have all required entries in /etc/hosts.. entries are:



Thanks,
-Ricky


Regards, Ricky
Oracle Weblogic 10g Certified Expert
TechPaste.Com
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

Here's a wild guess: when an app opens a port, it gives two pieces of info: the port number and the IP address. The app then listens to that port only on that IP address. I suspect that the telnet daemon is listening on the host's IP address (192.x.x.2), and not on 0.0.0.0 (which means listen on all IP addresses) or 127.0.0.1.


JBoss In Action
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 247

So then how I'll enable it to listen on all ports.

If there any config changes I need to make.

As the same configuration was working on RHEL4.x

And also I start my server always with bind option as -b 0.0.0.0

dont know then why its not binding to all .


Thanks.
-Ricky
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5772
    
    7

Wait a minute, what application are you running that is taking a "-b 0.0.0.0" argument? So far I have been assuming you are trying to connect to the telnet daemon.
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 247

Its my Java application which has webservice port 9922 deployed on Websphere 6.1

I used to check whether the port is accepting or not by telnet to tat port.
In my deployed application config file i mentioned localhost as agenthostname and webserviceport as 9922
so all calls goes like localhost:9922/blah format.

I'm using localhost instead of hostname because if i use localhost then i can copy paste the same config file to different machines in case of cluster rnv. once config file gets generated.

it was a regular practice for us till RHEL 4.x.x but i dont know why the same is not working in ver.5.

My question is if I'm getting the port and hostname listening then why i cant connect through localhost and the same port number.(min localhost should redirect to actual hostname as this all was working in previous RHEL versions)

Now the 2 work arounds are: ( Both works but i dont recomend):
1st one :I have to give hostname instead of localhost in my Apps config file. (Machine dependent config file cant do a copy paste to all machines)
2nd one: I have to edit the etc/hosts file and put hostname entry just before the localhost entry like

I dont recomend both work arounds.

Thanks.
-Ricky
[ November 05, 2008: Message edited by: Ricky Boxon ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

1. Use netstat -ln to determine whether the port is accessible. Normally localhost references would route through the loopback device.

2. Check iptables to make sure it isn't blocking. Out of the box, the stock RHEL iptables firewall setup should allow unlimited access from localhost, but if someone deleted that rule, you'd have a problem.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 247

Checked both.

Made a netstat -ln | grep 9922

Firewall is disabled.


All accept.

I dont know what is wrong.. :roll:

Thanks,
-Ricky
[ November 06, 2008: Message edited by: Ricky Boxon ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to telnet to 9922 port
 
Similar Threads
rmi.NoSuchObjectException
Java RMI Connection Problem
how to assign password for a user in shell script
Could not open connection to the host, on port 25: Connect Failed.
java.rmi.ConnectException: Connection refused to host