Implemented core socket functionality.