Network communication using sockets
To be able to interact with other players, we will need a way to communicate with them, regardless of the architecture used. To be able to communicate with any computer, we have to use sockets. In short, a socket enables communication with other processes/computers through the network as long as there is an existing way between both sides (LAN or Internet). There are two main kinds of sockets: non-connected (UDP) or connected (TCP). Both these need an IP address and a port number to communicate with their destination.
Notice that the number of available ports on a computer is contained between 0 and 65535. A piece of advice is to avoid the use of ports with a number lesser than 1024. The reason is that most of them are reserved by the system or used by common applications, such as 80 for a web browser, 21 for FTP, and so on. You also have to ensure that both sides of the communication use the same port number to be able to exchange data. Let's now see in...