Add a function to check if there is a TCP connection