improve openSocket