socket encapsulation