I'm trying to collect network statistics on my computer and draw a pie chart. An example is shown below.
my computer connects to port 80 75%
my computer connects to port 443 20%
my computer connects to port 443 5%
But I don't know how to get each port that my machine is connecting to.
I will be using Java to develop this.