The most common network architectures for an application are client-server and peer-to-peer.
A host, the server, is responsible for providing services to all requesting clients. The most famous client-server application include the Web, FTP, Telnet and e-mail.
In a P2P application there is a minimal reliance on a dedicated server because each hosts connected to the network may behave both as a client and a server. A central server might be necessary for peer-discovery. A very important characteristic of P2P network is self-scalability.
This architecture usually require peers to be also able to upload a significant amount of data (in contrast to how the internet is commonly used). P2P network may face problems that regard security (because it’s difficult to secure a vast amount of hosts) and incentive (such network rely on shared resources).
Since it’s possible to identify client-server even in a P2P application (the client is merely the hist that initiate a communication and the server the host that responds) it’s enough to understand how client and server communicate. Hosts on the network communicate by exchanging messages through the socket network interface.
The socket is the interface between the application layer and the transport layer and it also represent the API between application and network.
For a message to be sent to a specific process it must contain the address of the host and an identifier that specify the receiving process in the destination host. In the internet the destination address is specified by the IP address and the process identifier is determined by the port number.
Once a message is sent through the socket, it’s the transmission protocol (TCP, UDP, ..) that is responsible for getting the message to he destination socket. Different parameters can be considered when choosing the transmission protocol:
Data transfer reliability - Data loss may happens, for that reasons if an application require all packet sent to be received it may also happens that a packet needs to be sent more that once. In such case the data transfer became slower. In some application the loss of some packets can be tolerate in exchange for a fast transmission (video streaming).
Throughput - Different application may have or may not have throughput requirements. Those that require a minimal amount of throughput are said to be bandwidth-sensitive applications the other are called elastic applications.
Timing - Just like throughput, a transfer protocol may proved timing guarantees.
The main transfer protocols utilized are TCP and UDP.