How can you find out which process is listening on a TCP or UDP port on Windows?

On Powershell

TCP
Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess
UDP
Get-Process -Id (Get-NetUDPEndpoint -LocalPort YourPortNumberHere).OwningProcess

On CMD

C:\> netstat -a -b