Resolving port number to program name

I was just checking to see if anyone had a script that would allow me to go from port number to program name. I tried to create my own script but it looks like it only works for IPv4 sockets and it looks like daemons such as sshd return as AF_INET6 (in pfiles) for some reason. I can fix my script but the solution isn't immediately obvious and was just wondering if anybody has already fixed this problem as it seems popular.

I would use OpenCSW to install a better netstat but they want to minimize third party software on here.

  • Joel

---------- Post updated at 08:28 PM ---------- Previous update was at 08:16 PM ----------

found one online, so this question's more dead space for now, I'd like it to be deleted if at all possible.