Refactored Ping to use TcpSocket