cpp implentation of a connecting socket and its interface