HOWTO Determine which application is listening on a network port under Solaris

This article is incomplete and was first written in July 2007
for the BeezNest technical website (http://glasnost.beeznest.org/articles/362).
Netstat on Solaris (at least until 10 04/06) is not able to list which application is listening to which network ports but you sometimes need this. A simple script just doing the job Though, this script is pretty rough, and very slow.