Base socket infrastructure.