The Artima Developer Community
Sponsored Link

Java Buzz Forum
Find which process is holding a port open on Solaris

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Sam Dalton

Posts: 143
Nickname: samd
Registered: Jun, 2003

Sam Dalton is a Java Developer with ThoughtWorks in teh UK
Find which process is holding a port open on Solaris Posted: Apr 5, 2005 4:02 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Sam Dalton.
Original Post: Find which process is holding a port open on Solaris
Feed Title: import java.*;
Feed URL: http://www.samjdalton.com/pebble/rss.xml
Feed Description: Random, Infrequent Bloggings of a Techie
Latest Java Buzz Posts
Latest Java Buzz Posts by Sam Dalton
Latest Posts From import java.*;

Advertisement

This is something that I seem to need to do increasingly more often when debugging connection problems in our application. Sadly, I have no access to run lsof (which would give me this information), so I use the following script:

echo "which port?> "
read port

for pid in `ps -ef -o pid | tail +2`
  do
    foundport=`/usr/proc/bin/pfiles $amp;pid 2>&1 | grep "sockname:" | grep "port: $port$"`
    if [ "$foundport" != "" ]
    then
      echo "proc: $pid, $foundport"
    fi
done

This needs to be run as the user that owns the process that you suspect, so it is not fool proof, but it has proved very useful so far!

Read: Find which process is holding a port open on Solaris

Topic: Holly with Sponge Animal [Flickr] Previous Topic   Next Topic Topic: Don't quite get Yahoo! 360

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use