aspose file tools*
The moose likes Linux / UNIX and the fly likes How to check if a particular port assigned is listening Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "How to check if a particular port assigned is listening" Watch "How to check if a particular port assigned is listening" New topic
Author

How to check if a particular port assigned is listening

san ch
Ranch Hand

Joined: Oct 18, 2004
Posts: 68
Hi

iam working in solaris and configured my messaging server to port 82 ,i want to know how to check if this port is listening .......i tried
netstat -anp |grep 82
it jus gave me prompt again didnt understand
any help would be great
thank you in advance
san
Lewin Chan
Ranch Hand

Joined: Oct 10, 2001
Posts: 214
Are you running your messaging server as root, attempts to listen on a port < 1024 on Unix like systems is restricted to root only.

On solaris, I would probably check all the listening processes using


as netstat doesn't work in quite the same way as on Linux.

You'll get output like


So you know there's something listening on port 80, 5987, 38669 (etc etc).


I have no java certifications. This makes me a bad programmer. Ignore my post.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42623
    
  65
Try to telnet into port 82. If the connection is refused, there's nothing listening on that port.


Ping & DNS - my free Android networking tools app
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

On Linux grepping for the port number can fail if the port has an entry in /etc/services, such as "http". Thus you want to either search by service name or force numeric port display.

I believe that "netstat -ln" will do it for you.


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

Joined: Jun 02, 2003
Posts: 1923

I'm used to use

to check ports, and (as root)


http://home.arcor.de/hirnstrom/bewerbung
san ch
Ranch Hand

Joined: Oct 18, 2004
Posts: 68
Hi

Thank you for your response,iam working as root ,i will try these things.
i ahve tried
and iam getting the prompt normally ,does this mean the port is listening???the telent to the port looks like a good idea will see if i can do that thank you soo much
san ch
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

No, that means 'not listening'
Grep filters lines (from the output, if used in a pipe) and displays only matching lines.
A better command would be:
san ch
Ranch Hand

Joined: Oct 18, 2004
Posts: 68
Thank you for your help it is working

san ch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check if a particular port assigned is listening