Wednesday, March 6, 2019

networking - How do I check how many connections are open currently on a specific TCP port?



I'm doing some comet benchmarks and would like to see how many open connections I have.



Actually I use netstat:



netstat -ant | grep 8080 | grep EST | wc -l



But it needs around 4-6 minutes to list the number, is there any tool that can do show it in real time?
The number of open connections is between 100'000 - 250'000.


Answer



Don't know if lsof is better, but give this a try:



lsof -ni:8080 -sTCP:ESTABLISHED | wc -l

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...