Basics of sockets
Network programming in any programming language can begin with sockets. But what is a socket? Simply put, a network socket is a virtual end point where entities can perform inter-process communication. For example, one process sitting in a computer, exchanges data with another process sitting on the same or another computer. We typically label the first process which initiates the communication as the client and the latter one as the server.
Python has quite an easy way to start with the socket interface. In order to understand this better, let's see the big picture first. In the following figure, a flow of client/server interaction is shown. This will give you an idea of how to use the socket API.
In the interaction between a typical client and a server, the server process has to work a bit more, as you may have thought. After creating a socket object, the server process binds that socket to a particular IP address and port. This is...