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. It uses informations about PIDs found in /proc. A better alternative would be to use lsof from Sunfreeware.com:
lsof -i|grep port
or this might work as well
lsof -i :port