Moved socket connect to the read thread because it is blocking