Add status check with sockets
Now use the checkStatus function and close the socket