Documentation
Source
TCP:
sudo nc -l <portnumber>
UDP:
sudo nc -lu <portnumber>
nc -zu <ip> <port-range>