Network applications are the reason for a computer network’s existence — if we couldn’t think of any useful applications, there would be no need for networking protocols that support these applications. Numerous useful and entertaining applications have been developed since the inception of the Internet. These applications have been the driving force behind the Internet’s success, inspiring people in homes, schools, governments, and businesses to incorporate the Internet into their daily lives.
The application layer is an excellent place to begin our protocol exploration. It’s familiar territory. Many of the applications that rely on the protocols we’ll look at are familiar to us. It will provide us with a good understanding of what protocols are all about.
Before we go any further, let us give you a quick refresher on networking.
A Brief Overview Of Computer Networking
Networking refers to the interconnected systems and devices that allow data to be transmitted and received. This includes everything from the cables and switches that connect devices to the protocols and software that control the flow of data.
Types Of Networks
There are several types of networks, including:
Local Area Networks (LANs): These are networks that connect devices in a small area, such as a home or office. LANs can be wired or wireless and they typically use Ethernet or Wi-Fi protocols.
Wide Area Networks (WANs): These are networks that connect devices over a large area, such as a city or country. WANs typically use telephone lines, cables, or satellite links to connect devices.
Metropolitan Area Networks (MANs): These are networks that connect devices within a metropolitan area. They are larger than LANs but smaller than WANs.
Virtual Private Networks (VPNs): These are networks that use the internet to connect devices in a secure way, allowing remote workers to access a company’s internal network as if they were in the office.
The Internet: It is the largest and most widely used network, connecting millions of devices worldwide.
Networking allows devices to communicate with each other, enabling the sharing of resources and the exchange of data. It also enables the use of distributed systems, where multiple devices work together to achieve a common goal.
Networking protocols are the set of rules that devices use to communicate with each other, these protocols often follow a layered architecture such as the OSI model and TCP/IP. they enable the devices to understand each other and make sure that the data is transmitted and received correctly.
The OSI Model
The seven layers of the OSI model are:
Physical Layer: Physical Layer is responsible for the physical connection between devices, such as cables and switches.
Data Link Layer: Data Link Layer is responsible for creating a reliable link between devices by establishing a connection and controlling the flow of data.
Network Layer: Network Layer is responsible for routing data between different networks, determining the best path for data to travel.
Transport Layer: Transport Layer is responsible for ensuring that data is delivered reliably and in the correct order, by using techniques such as flow control and error checking.
Session Layer: Session layer establishes and manages the connections between different applications.
Presentation Layer: Presentation Layer is responsible for translating the data into a format that can be understood by the application layer, such as converting between different file formats.
Application Layer: Application Layer is the topmost layer of the OSI model, and it is responsible for interacting directly with the user and providing services such as file transfer or email.
In this architecture, each layer serves the layer above it, and the layer beneath it is served in turn. In a given message between users, data will flow through the layers of the source computer, across the network, and through the layers of the receiving computer.
It is important to note that the OSI model is a theoretical model, and not all protocols in use map directly to it. Nonetheless, the OSI model provides a common point of reference for understanding how various protocols and technologies interact in a network environment.
The TCP/IP model and the OSI model, as you will see in a later tutorial, serve two different purposes. The OSI model is more of a theoretical model that serves as a standardization or guideline for Internet specification. The TCP/IP model accurately represents the protocols used on the internet.
TCP/IP is an acronym that stands for Transmission Control Protocol/Internet Protocol. It is the set of protocols used to send data across the internet and most computer networks.
Don’t be concerned about all the networking jargon. All you need to know and understand at this point is that the OSI model is a theoretical model for understanding the various components of data communications. However, most data communications today use the TCP/IP model, which includes the same functions but does not clearly outline the various communication layers as OSI does.
The TCP/IP protocol suite is made up of four layers:
- Link Layer: The Link Layer is responsible for providing a reliable link between devices on a local network, such as Ethernet or Wi-Fi.
- Internet Layer: The Internet Layer is responsible for routing data between different networks, using the Internet Protocol (IP). IP is responsible for addressing and routing packets to their destination.
- Transport Layer: The Transport Layer is responsible for ensuring that data is delivered reliably, using the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP).
- Application Layer: The Application layer is responsible for providing services such as email, file transfer, and web access to users.
A picture of the TCP/IP layers can be represented like this:
TCP is a connection-oriented protocol that ensures that data is delivered reliably and in the correct order. It does this by adding a sequence number to each packet of data, and requiring an acknowledgment for each packet that is received. If a packet is lost or corrupted, the sender will automatically resend it until it is received correctly.
UDP, on the other hand, is a connectionless protocol that does not guarantee the delivery of packets. It is faster than TCP, but it is better suited for applications that do not require a high level of reliability, such as streaming media or online gaming.
The TCP/IP protocol suite is the foundation of the internet and most computer networks. It enables devices to communicate with each other regardless of the underlying hardware or operating system.
TCP/IP (Transmission Control Protocol/Internet Protocol) is the primary model used by the Internet. We covered the link layer and internet layer in great detail in our fundamentals of computer networking course. This course will focus entirely on the Transport and Application Layers.
We will look at the conceptual and implementation aspects of network applications in this course. We start by defining key application-layer concepts such as
- Network Services Needed By Applications
- Clients And Servers
- Processes And How They Communicate
- Transport-Layer Interfaces.
In this course, we will briefly discuss some topics because understanding the concept requires understanding of some other concepts that we will cover later. On those occasions, we want you to have faith in us. We will return to explain the topics in greater depth once we have more toolbox in our disposal.
Java As A Network Application Programming Language
Assume you have a concept for a new network application. Perhaps this application will be of great benefit to humanity, please your professor, bring you great wealth, or simply be enjoyable to create. Whatever the motivation, let’s now look at how to turn the concept into a real-world network application.
Writing programs that run on different end systems and communicate with each other over the network is at the heart of network application development. In the Web application, for example, there are two distinct programs that communicate with each other: the browser program, which runs in the user’s host (desktop, laptop, tablet, smartphone, and so on), and the Web server program, which runs in the Web server host. In a P2P file-sharing system, for example, each host has a program that participates in the file-sharing community. The programs in the various hosts may be similar or identical in this case. In a later tutorial, we will go over web clients and servers. For the time being, just remember that these things exist.
When creating a new application, you must write software that will run on multiple end systems. This software could be written in C, Java, or Python, for example. You do not need to write software that runs on network core devices like routers or link-layer switches. In fact you wouldn’t be able to write application software for these network-core devices even if you wanted to. Network-core devices, as we learned in Fundamentals of Networking, do not function at the application layer, but rather at lower layers, specifically the network layer and below. This fundamental design—specifically, confining application software to end systems—facilitated the rapid development and deployment of a diverse set of network applications.
In this course, we will use Java as our programming language for computer networking.
Java network programming typically uses the socket programming model, which is based on the Internet Protocol (IP) and Transmission Control Protocol (TCP). Sockets provide a common interface for sending and receiving data over a network. Again don’t worry if you if you don’t know what a Socket is.
In socket programming, there are two types of sockets: client sockets and server sockets. A client socket is used by an application to initiate a connection to a server, while a server socket is used by an application to listen for incoming connections from clients.
Java’s socket programming model is based on the Berkeley sockets model, which is a widely used standard for network programming. The Berkeley sockets model is similar to the OSI model, as it defines a set of functions and structures that provide a common interface for network programming.
Java provides classes such as java.net.Socket and java.net.ServerSocket to create and manage sockets in your application. These classes provide methods for connecting to servers, sending and receiving data, and closing connections. Do not worry! You will see them in action!
It’s worth noting that Java also provides other networking APIs that use higher level protocols such as HTTP and FTP. These APIs use sockets under the hood but make it easier for the developer to interact with these protocols.
To learn more about how Socket Programming works, visit Network Programming In Java.
In the following tutorials, we will first go over all of the concepts you will need to know in order to write killer network applications. We will start with the network applications architecture.
Network Application Architectures
Network Application Architectures are the design patterns and organization of network-based software systems. They describe how the various components of a network application interact with each other and how the data flows between them. Network applications can be designed to perform a wide variety of functions and they can be used in a variety of different environments.
You should have a broad architectural plan for your application before diving into software coding. Keep in mind that the architecture of an application is distinct from the architecture of a network (discussed in Fundamentals Of Networking). From the perspective of an application developer, the network architecture is fixed and provides a specific set of services to applications. In contrast, the application architecture is designed by the application developer and dictates how the application is structured across the various end systems.
There are several types of network application architectures, each with its own advantages and disadvantages. Some of the most common architectures are:
- Client-Server: This is the most common architecture, in which a client application requests services from a server application. The server provides the requested services, and the client receives the results. This architecture is well suited for applications that require centralized control and security, such as email or file servers.
- Peer-to-Peer: In this architecture, each device or application is both a client and a server, allowing them to share resources and communicate directly with each other. This architecture is well suited for applications that require distributed control and scalability, such as file sharing or gaming.
- Service-Oriented: In this architecture, applications are built around a set of services that can be reused and combined to create new applications. This architecture is well suited for applications that require flexibility and modularity, such as e-commerce or web services.
- Microservices: This is a variation of the Service-Oriented architecture, in which applications are broken down into small, independent services that communicate with each other over the network. This architecture is well suited for applications that require scalability, fault tolerance, and flexibility, such as cloud-based systems.
- Event-Driven: In this architecture, applications communicate with each other by sending and receiving events, rather than requests and responses. This architecture is well suited for applications that require real-time communication, such as IoT systems or financial applications.
Each architecture has its own set of trade-offs, and the best choice depends on the specific requirements of the application and the environment in which it will run.
An application developer will most likely choose one of the two predominant architectural paradigms used in modern network applications: client-server architecture or peer-to-peer (P2P) architecture.
In the following tutorial, we will go over these two architectures in great detail.