Sockets are used for interprocess communication. Interprocess communication is generally based on client-server model. In this case, client-server are the applications that interact with each other. Interaction between client and server requires a connection. Socket programming is responsible for establishing that connection between applications to interact.