Make sure socket descriptor is set to -1 so that output_is_connected 'knows' the socket is connected.