Check out example codes for "open ports on RPI". It will help you in understanding the concepts better.

Code Example 1

netstat --tcp --listening --programs --numeric

Code Example 2

netstat -lptn

Learn ReactJs, React Native from akashmittal.com