Check out example codes for "netstat -tln mysql". It will help you in understanding the concepts better.

Code Example 1

lsof -n -P -i TCP -s TCP:LISTEN

Learn ReactJs, React Native from akashmittal.com