Network Programming: The computer network.
Tags: programming, beginners, network
Published: 2023-10-10 23:29:38

## Table of Contents
&nbsp;1. [Introduction](#introduction)
&nbsp;2. [What is a Computer Network?](#what-is-a-computer-network)
&nbsp;3. [Types of Computer Networks](#types-of-computer-networks)
&nbsp;4. [Conclusion](#conclusion)

## Introduction

You have probably worked into several internet cafes in an attempt to photocopy or print a document. 

**-** You walk straight to the person in charge and tell him you need a printed copy of the document you have on your device. 

**-** You send him the document. After a few minutes, he walks to the printer and gets you a copy of the document you sent him.

But how exactly did the document you sent to his computer get to the printer?

Well, the computer connects to the printer's IP address and sends the data in a language the printer knows. This is possible with the help of **Computer Network.**

## What is a Computer Network?

A computer network is a bunch of devices connected to exchange information — emails, documents, audio/video data — or to share a resource — printers, storage and other physical devices. Typically, computers in a network are called **hosts**, while **links** are the elements that connect them.

- The scenario painted above about the connection between a printer and a computer is one example of a computer network.

- Receiving files from a friend's device through Bluetooth or Xender connection is another example of a computer network.

- The connection between your favourite browser(chrome for example) and the servers where the data you request are stored is yet another example. The list is endless.


## Types of Computer Networks

Computer networks range from very small to very large. Based on size, they're referred to as:

- **Local Area Network (LAN)** - Few hosts(computers) connected over a limited area. Like the ones we find inside houses, schools or offices.

- **Metropolitan Area Network (MAN)** - A larger network that extends across a city and can be conceptually seen as many smaller LANs connected together.

- **Wide Area Network (WAN)** - an even bigger network, which connects multiple **MANs or LANs** and can span the whole world.

Engineers are also working on a type of **interplanetary computer network** that connects satellites, planetary rovers and the Earth,  which at this time is not of our interest.

Computer networks can be analysed both at a hardware and software level. Physically, a network is made of computers, cables and other machinery that makes it work correctly. Understanding computer networks on the hardware level involves a lot of physics, mathematics and electronics to describe how the signal travels around, along with the technology behind components and computers. The software level on the other hand involves programs, instructions and algorithms(a set of step-by-step instructions for solving a problem) that give life to the physical counterpart - computers, cables, routers, etc.

The hardware part of a computer network is beyond the scope of this article series. Our focus will be on the software level which involves **Network Programming:** writing programs that communicate with other programs across a computer network.

All networks are based on one or more **network protocols** - a set of rules that determine how information should be transmitted between different computers in the same network.

For example, the **HyperText Transfer Protocol (HTTP)** describes how to fetch and share resources, such as text documents, over a network. It also describes all the hardware components required for the resource exchange to work correctly. Thanks to the HTTP you can browse this page on your device, add comments in the box below or share it on social media.

The list of existing network protocols is quite huge and spans across multiple domains. While the list may be a long one, they all follow the **Open System Interconnection(OSI) model**. 



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x85ipfutd64xmslo2prx.png)



## Conclusion

We have established that computer networks are crucial in modern systems and applications. While a few standalone systems like Microsoft Word, Calculator app, Adobe Photoshop etc., can operate without the need to connect to other hosts/applications, most systems require some sort of connection to other hosts to function hence the need for a Computer Network.

In future articles, we will explore some of the different layers of computer protocols - **network layer(IP),** **transport layer(TCP/UDP)** and **application layer(HTTP/FTP),** and how they follow the **OSI** model.