As we mentioned previously, a socket is an abstraction over network communication. We treat them as regular files – everything written to a socket is sent via the network to its destination by the operating system. Everything that is received via the network is written into the socket – again, by the operating system. This way, the OS provides two-way communication for network applications.
Let's suppose that we run two different applications working with the network. For example, we open a web browser to surf the web and use a messaging application (such as Skype) to chat with friends. The web browser represents a client application in a client-server network architecture. The server, in this ...