How to know if a network port is connected