Implement socket methods.