first c version socket wrapper.