Sockets are used for data communication and they use protocol for doing this. This is the general view and usage of sockets and for achieving this each programming language uses some features, functions or techniques.