Encapsulation of socket and socket API