Moved the end of start_socket_client() into a new function called