socket can not be opened in method connected?