Socket implementation.