Home Blog Page 34

Manipulators in C++ (with Examples – setw, setbase, ends, setfill, flush, ws)

0

Manipulators are special functions that can be included in the I/O statement to alter the format parameters of a stream. To access manipulators, the file iomanip.h should be included in the program. In this article, we have shared the list of Manipulators in C++ and functions of manipulators with examples.

What are Manipulators in C++?

manipulators are simply an instruction to the output stream that modify the output in various ways. In other words, we can say that Manipulators are operators that are used to format the data display.

Advantages and Purpose of Manipulators

  • It is mainly used to make up the program structure.
  • Manipulators functions are special stream function that changes certain format and characteristics of the input and output.
  • To carry out the operations of the manipulators <iomanip.h> must be included.
  • Manipulators functions are specially designed to be used in conjunction with insertion (<<) and extraction (>>) operator on stream objects.
  • Manipulators are used to changing the format of parameters on streams and to insert or extract certain special characters.

Types of Manipulators in C++

They are of two types one taking arguments and the other without argument.

1. Non-argument manipulators (Without Parameters)

Non-argument manipulators are also known as “Parameterized manipulators”. These manipulators require iomanip header. Examples are setprecision, setw and setfill.

2. Argumented manipulators (With parameters)

Argument manipulators are also known as “Non parameterized manipulators”. These manipulators require iostream header. Examples are endl, fixed, showpoint, left and flush.

Standard input/output Manipulators in C++

Here is the list of standard input/output Manipulators and their Functions in C++

  • setw (int n) – To set field width to n
  • Setbase – To set the base of the number system
  • stprecision (int p) – The precision is fixed to p
  • setfill (Char f) – To set the character to be filled
  • setiosflags (long l) – Format flag is set to l
  • resetiosflags (long l) – Removes the flags indicated by l
  • endl – Gives a new line
  • skipws – Omits white space in input
  • noskipws – Does not omit white space in the input
  • ends – Adds null character to close an output string
  • flush – Flushes the buffer stream
  • lock – Locks the file associated with the file handle
  • ws – Omits the leading white spaces present before the first field
  • hex, oct, dec – Displays the number in hexadecimal or octal or in decimal format

Must Read ➜ What is HTTP?

Manipulators in C++ With Examples

The manipulators in C++ are stream functions that change the properties of an input or output stream. It’s used to format the input and output streams by modifying the stream’s format flags and values. 

The header file iomanip.h> contains a set of manipulator functions.

To utilize the manipulator functions in your program, you must include this header. 

The following is a list of standard Functions in manipulator in C++. 

The stream.h header file defines the hex, dec, oct, wsendl, ends, and flush functions. The rest is defined in the header files iomanip.h. 

►  endl is a function in Manipulators in C++:

The endl character introduces a new line or a line feed. It is analogous to the “n” character in the C computer language, and C++ supports the old line feed. 

As an example, 

cout << "This line use line feed as example" << endl; 

 cout << number3 <<  endl << number4 << endl; 

You can use it anywhere and a new line character is added. It adds automatically. 

Example Program #1 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

 using namespace std;o 

 int main() 

{ 

cout << " Hello World"; 

cout << endl; 

cout << " The Author is Damon salvatore"; 

cout << endl; 

system("PAUSE"); 

return EXIT_SUCCESS; 

} 

Output: 

Hello World 

 The Author is Damon Salvatore

Must Read ➜ What is Cyclic Redundancy Check (CRC)?

►  setbase() is a function in Manipulators in C++:

The setbase() manipulator is used to change the base of a number to a different value. The following base values are supported by the C++ language: 

  • hex (Hexadecimal = 16) 
  •  oct (Octal = 8) 
  •  dec (Decimal = 10)  

Setbase () can change the base of a variable in addition to the base converters listed above. The manipulators hex, oct, and dec can change the basis of input and output numbers. 

For example, 

int number = 100; 

cout << "Hex Value =" << " " << hex << number << endl; 

cout << "Octal Value=" << " " << oct << number << endl; 

cout << "Setbase Value=" << " " << setbase(16) << number << endl; 

The output of the above code is: 

Hex Value =  0064 

Octal Value =  144 

Setbase Value= 0064 

Example Program: 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

 using namespace std; 

 int main() 

{ 

    //Variable Declaration 

    int A,B,C; 

    //Variable Initialization 

    A = 2078; 

   B = 3067; 

   // Computing C 

    C = A + B;  

   // Printing Results  

 cout << "A =" << dec << A <<endl;

 cout << "B =" << oct << B << endl; 

cout << "C = " << setbase(16) << C << endl;

system("PAUSE"); 

return EXIT_SUCCESS; 

} 

Output: 

A =2078 

B =5773 

C = 1419 

►  setw () is a function in Manipulators in C++:

The setw() function is an output manipulator that inserts whitespace between two variables. You must enter an integer value equal to the needed space. 

setw ( int n) 

As an example, 

cout << number5 << number6 << endl; 

cout << setw(2) << number5 << setw(5) << number6 << endl; 

 Example Program: 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

using namespace std; 

int main() 

{ 

  //variable declaration 

int number1, number2, total; 

//variable initialization 

number1 = 100; 

number2 = 345; 

// expression  

total = number1 + number2; 

//printing output with setw 

cout << endl; 

cout << endl; 

cout << setw(5) << number1 << " + " << setw(5) << number2 << " = "  << setw(6) << total << endl; 

system("PAUSE"); 

return EXIT_SUCCESS; 

} 

Output: 

100 +   345 =    445 

Must Read ➜ Recursion Function in Python

►  setfill() is a function in Manipulators in C++:

It replaces setw(whitespaces )’s with a different character. It’s similar to setw() in that it manipulates output, but the only parameter required is a single character. It’s worth noting that a character is contained in single quotes. 

setfill(char ch) 

For example, 

cout<< setfill('*') << endl; 

cout << setw(5) << number5 << setw(5) << number6 << endl; 

The output of the above will be ‘*’ character between variable number5 and variable number6. 

Example Program: 

We will use the above setw() example with a little modifications. 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

using namespace std; 

int main() 

{ 

    //variable declaration 

int number1, number2, total; 

  //variable initialization 

number1 = 100; 

number2 = 345; 

// expression  

total = number1 + number2; 

//printing output with setw 

 cout << endl; 

 cout << endl; 

cout << setfill('*') << endl; 

cout << setw(5) << number1 << " + " << setw(5) << number2 << " = "  << setw(6) << total << endl; 

system("PAUSE"); 

return EXIT_SUCCESS; 

} 

Output: 

**100 + **345 = ***445 

 

►  setprecision() is a function in Manipulators in C++:

It is an output manipulator that controls the number of digits to display after the decimal for a floating point integer. Make careful to include the ipmanip header in your program because the function is defined there. 

As an example, 

float A = 1.34255; 

cout << setprecision(3) << A << endl; 

The output is 1.34. 

Example Program: 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

using namespace std; 

 

int main() 

{ 

    //variable declaration 

    float number1; 

     

    //variable initialization 

number1 = 34.3358; 

     

    //display the number using setprecision() 

    cout << number1 << endl; 

    cout << setprecision(2) << number1 << endl; 

    cout << setprecision(3) << number1 << endl; 

    system("PAUSE"); 

    return EXIT_SUCCESS; 

} 

Output: 

34.3358 

34 

34.3 

►  ends in C++

A string type value is given a null terminating character (‘0′) via the ends command. It doesn’t take an argument like endl; instead, it just adds a null.

Program as an example: 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

using namespace std; 

int main() 

{ 

    // variable declaration      

    int amount;    

    // variable initialization   

    amount = 333; 

    //display as a string 

     cout << " \" " << amount << ends << " \" " << endl; 

      system("PAUSE"); 

    return EXIT_SUCCESS; 

} 

Output: 

 ” 33 “ 

Must Read ➜ What is Multiplexing?

►  ws in C++

The ws is an input stream manipulator that removes all-white spaces, so if you have a string with multiple words, it will only display the first one and trim the rest. 

Example Program: 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

using namespace std; 

int main() 

{ 

    // variable declaration 

       char name[125]; 

   // read variable value 

      cout << "Enter your name" << endl; 

    cin >> ws; 

    cin >> name; 

//display variable with whitespace 

    cout << "The Name  is "<< name << endl; 

   system("PAUSE"); 

    return EXIT_SUCCESS; 

} 

Output: 

Enter your name 

Damon 

The Name  is Damon 

►  flush in C++

The flush function removes all data from the output stream. It’s an output manipulator, so it won’t function with an input stream. The console screen’s output buffer is automatically emptied, however, the flush function is handy for cleaning the file output buffer following file operations. There are no arguments for this function. 

Example Program: 

#include <cstdlib> 

#include <iostream> 

#include <iomanip> 

using namespace std; 

int main() 

{ 

 //using Flush manipulator 

 cout << "Hello" << endl; 

 cout << "World" << endl; 

 cout.flush(); 

  cout << "Output Buffer Cleared" << endl; 

  system("PAUSE"); 

  return EXIT_SUCCESS; 

} 

Output: 

Hello 

World 

Output Buffer Cleared 

Data Communication: Types, Components, Characteristics & Functions

0

Data communication is the electronic exchange of data between two devices across a communication channel like a wire pair cable or Fiber optics. In this article, we have shared all the details about data communication.

Topics that are covered in this article are as follows;

  • Definition of Data Communication
  • Characteristics of Data Communication
  • Types of Data Communication
  • Components of Data Communication
  • Protocols and Standards

⦿ Definition of Data Communication

The process of exchanging data and information electronically from one location to another over transmission media is known as data communication.

Only when communicating devices are part of a hardware and software-based communication system do data communications occur. 

In a computer, Data communication allows electronic or digital data to be sent between two or more devices regardless of their geographical location, transmission medium, or data substance.

The message, sender, receiver, transmission medium, and protocol are all crucial elements in data communication. 

⦿ Characteristics of Data Communication

Data communication has four critical characteristics that are as follows: 

  • Delivery 
  • Accuracy 
  • Timeliness  
  • Jitter 

► Delivery

Data must be sent in the correct order from the source device to the correct destination.

► Accuracy:

The information must be supplied without errors. The data should be retransmitted if there is any inaccuracy during transmission. 

► Timeliness:

Data must be given within the timeframe provided. The data that was given late has become unusable. 

► Jitter:

Jitter is caused by an uneven or unexpected delay in the packet arrival time.

Must Read ➜ What is HTTP?

⦿ Types of Data Communication (Transmission Mode)

types of data communication

Here are the modes of Data transmission in communication.

  1. Simplex Mode
  2. Half-Duplex Mode
  3. Full-Duplex Mode

► 1. Simplex Mode

  • A simplex mode of communication sends a message in only one direction.
  • The message source (sender) works as the transmitter.
  • The sender sends the message over the data channel to the receiver, The receiver is the destination of the message.

For example, Radio stations and TV broadcasts work as Simplex data communication. The point to be noted here is that there is no ability by the receiver to respond to the message in the simplex channel.

► 2. Half Duplex

  • Half-duplex data communication system provides messages in both directions but only allows transfer in one direction at a time.
  • In this process, once a party begins sending a transmission, the receiver must wait until the signal stops before responding.
  • If both parties attempt to send data at the same time, they both fail.

For example, if you talk on a CB radio (Citizens band radio), you press a button and speak. But if the receiver attempts to press the button and speak at the same time then neither one of you hear either message. The CB radio system is not capable of sending both ways simultaneously.

► 3. Full Duplex

  • A full-duplex is that type of data communication that works both ways at the same time.
  • Full-duplex mode is basically a set of two simplex channels, one works as a forward channel and the other as a reserve channel.
  • The Two channels link together at some point in a full-duplex system.

For example, Landline Telephone works on a full-duplex communication system. If someone wants to talk on the telephone, then both parties have the ability to speak at the same time. It is because the data carried both ways through the telephone line run simultaneously.

There is one more mode of communication that is Serial Communication, it is not talked about so much but for your knowledge purpose, take a look at this in brief.

► Serial Communication

  • Serial Communication is that type of data communication that breaks up data into small pieces and sends the message one bit at a time through a channel.
  • The receiver collects data in the form of small bits and reassembles them to compose the original message.
  • Serial communication is the most common type of data communication between electronic devices.

For example, Data sent from a Modem device to the service provider works on the serial communication system.

Must Read ➜ Application Layer Protocols

⦿ Methods of Data Transfer in Communication

The following are examples of well-known data transfer methods:

  • From one personal computer to another
  • From a personal computer to a server computer 
  • Processor to Processor communication

► From one personal computer to another

Personal computers, in general, may interact and communicate with one another on a one-to-one basis. There are no limitations on how much information people can share with one another.

► From a personal computer to a server computer

In order to send, receive, and save data, a networked personal computer relies on a big computer known as the host computer. A mid-range server or a supercomputer can be used. The personal computer receives both processing and data from the host computer. 

► Processor to Processor communication

This form of communication occurred between two or more computers that exchanged a considerable volume of data, such as a file or record updates, and so on. It also outlines how two or more computers communicate when working as a squad.

This sort of communication is common amongst computers in close proximity.

Data communication can be further subdivided into two subtypes.

They are as follows;

  • Communication via the Internet 
  • Online and Offline Communication 

► Communication via the Internet

Devices are directly connected to exchange information in this connection. A direct link is established between the devices exchanging data, and the data is transferred promptly. The capacity of the line and the amount of data to be transmitted determine the actual data transfer time. 

► Online and Offline Communication

Information is not delivered instantly through this transmission. The data is being readied for transmission. Because the data is processed in batches before being shared at a predetermined time, this is a sort of batch process communication. 

Must Read ➜ What is Cyclic Redundancy Check (CRC)?

⦿ Types of Signal in Data Communication

Data communication can be classified on the basis of signals into the following categories: 

  • Transmission of Analog Data Signal 
  • Transmission of Digital Data Signal

► Transmission of Analog Data

Data is communicated from one device to another in the form of analog signals or continuous waves in analog data transfer. A continuous electrical wave is used to generate analog signals. Sound waves, light waves, and radio waves are all instances of analog signals. 

► Transmission of Digital Data

Data is transported from one location to another via electrical pulses or digital signals in digital data exchange. Electric pulses form the basis of a digital signal. Each electrical pulse represents bits that have been combined to form bytes. A computer is a device that receives and interprets digital data. 

Data is transmitted using a telephone line, microwave technology, or satellite in digital data transfer. A modem is required on both the sending and receiving devices in this system. A modem is a device that converts analog signals to digital signals and back.

⦿ Components of Data Communication

5 components of data communication

Only when the communicating devices are part of a hardware and software-based communication system can the data communications process take place. The message, sender, receiver, transmission medium, and protocol are all critical parts of a successful data communication process.

Five (5) major Components of Data Communication are as follows:

  • The Message 
  • The sender 
  • Recipient 
  • Medium of Transmission
  • Etiquette 

► 1. The Message

The data or information being sent from the sender to the receiver is referred to as a message. It could be made up of text, images, music, video, graphics, or photos, among other things. 

► 2. The sender

The sender is a device that generates and sends messages. Text, numbers, photos, graphics, music, video, and other media may be used to convey the message. A sender is sometimes referred to as a source, transmitter, or node. In most data transmission systems, the computer functions as a transmitter. 

► 3. Recipient

The transmitter sends a message to the receiver, which is a device that receives it. It’s also known as a sink. The receiver is usually located somewhere other than the sender. A computer, printer, or another computer-related device can be used. In addition, the receiver must be able to accept the message. 

► 4. Medium of Transmission

It is the physical road or channel that the communication travels from the sender to the receiver. The communication medium can be wired, such as twisted-pair wire, coaxial cable, or fiber-optic cable, or wireless, such as lasers, radio waves, or microwaves. 

A medium is a physical conduit or path by which a message is transmitted from the sender to the receiver. It’s required since it connects the sender and recipient. Twisted-pair wire, coaxial cable, fiber-optic cable, or wireless technologies such as lasers, radio waves, and microwaves may be used as the medium. 

► 5. Etiquette (Protocol) in Data Communication

A protocol is a set of instructions for transmitting data between computers. These protocols define how a communication channel is established, how information is delivered, and how errors are recognized and repaired during the data communication process.

⦿ Protocols & Standards of Data Communication

The major protocols (etiquette) and standard of data communication are as follows:

  • Sequencing of Data
  • Routing of Data
  • Flow of Information
  • controlling of Errors
  • Process of Coding

► Sequencing of Data in Communication

Data sequencing is the process of breaking down a large message into smaller chunks. A large communication is broken down into smaller, identical packets. If an error is identified, this strategy also decreases the quantity of data that must be resent. 

► Routing of Data

Before delivering data, data routing is the process of determining the most efficient path between source and destination. This method also improves the efficiency of data transmission. 

► Flow of Information

In terms of speed, not all computers are created equal. If the transmitter computer is faster than the reception computer, data flow is a mechanism that ensures proper data delivery. 

► Controlling errors

These protocols’ primary function is to control errors. One of the most important functions of a communication protocol is to detect and recover faults. It ensures that data is sent without interruption. If a mistake is identified, it also solves the problem. 

► Process of Coding

Only binary numbers are used by the computer. It uses binary digits to store all forms of data. Before being stored in the computer, the data is transformed to binary form. ASCII refers to the process of transforming data into binary form. 

The American Standard Code for Information Interchange (ASCII) is an acronym for American Standard Code for Information Interchange.

This code is a set of standardized characters for encoding data. It was issued by ANSI in 1968. (American National Standard Institute). It has a 256-character capacity.

Multiplexing (FDM, WDM, TDM): Use, Type, Technique, Computer Networking

0

We’ll go through the notion of multiplexing in computer networks in this tutorial. We have shared all the basic information about MUX used in networking. In this article, You will also learn the definition, importance, benefits, techniques, and different types of Multiplexing such as FDM, WDM, TDM, and their uses. 

What is Multiplexing?

Multiplexing in Computer Networks is a term used to describe a collection of procedures that permits several signals to be sent over a single data link at the same time.

Multiplexing is accomplished with the help of a piece of hardware known as a multiplexer (MUX).

Meaning & Definition

Multiplexing is a process of sending the number of separate signals together over the same cable or bearer, simultaneously and without interference.

In Other Words,

Multiplexing is a technique where several users use the medium simultaneously without interference or with minimum interference.

What is Multiplexer and how it works?

A multiplexer (MUX) is a device that allows digital information from several sources to be routed onto a single line for transmission over that line (medium) to a common destination.

On the sender side, the Multiplexer (MUX) primarily mixes ‘n’ input lines in order to generate a ‘1’ output line (this is simply many-to-one).

This stream is routed into the demultiplexer (DEMUX) on the receiver side, which divides the stream into its component transmissions (one-to-many) and directs them to their associated lines. 

The main objective of using the multiplexer technique is to share scarce resources. 

Let’s look at how to partition one link into n channels using the diagram below: 

multiplexing process

The term link refers to the physical path in the figure above, while the term channel merely refers to the segment of the connection that conducts a transmission between two lines. As a result, a single link can have several channels. 

History of Multiplexers

  • Multiplexers in Computer Networking has a long and illustrious history.
  • Several telephone calls can be carried over a single line in telecommunications.
  • Multiplexers were also invented in the 1870s in telegraphy.
  • This method is now frequently used in telecommunications.
  • In telephony, George Owen Squier is credited with developing telephone carrier multiplexing in 1910. 

Importance of Multiplexing

Multiplexing in data communication systems and Computer networks is very much required. As we previously stated, multiplexing is a set of techniques that permits the transmission of many signals at the same time through a signal data link. 

When there is a requirement to send numerous signals from the sender side at the same time, a multiplexer is used to combine numerous signals into one so that we may receive them all at the same time on the receiving end. 

Sending many signals in different ways is quite expensive, and it also necessitates the use of extra lines.

As a result, multiplexing is required. Consider a television cable distributor that distributes multiple channels over a single wire.

Must Read ➜ What is HTTP?

Advantages of Multiplexing

The following are some of the benefits and advantages of employing multiplexing: 

  • It allows for the transmission of numerous signals via a single medium or link. 
  • Multiplexing aids in the efficient exploitation of the medium’s bandwidth. 

Techniques of Multiplexing (Types of Multiplexer)

types of multiplexing

Multiplexing is divided into two categories i.e. Analog and Digital.

There are mainly three types of techniques used in multiplexing. Let’s have a look at these various types of multiplexers:

  • Frequency Division Multiplexing 
  • Wavelength-division Multiplexing
  • Time-division Multiplexing

In the following sections, we’ll go through each of the above-mentioned techniques one by one.

1. Frequency-Division Multiplexing (FDM)

FDM or Frequency-Division Multiplexing is an analogy technology in which frequency technology is used

Signals with different frequencies are merged in a composite signal and then broadcast over the link using this technique. It is mostly used when the link’s bandwidth is greater than the total bandwidths of the signals to be delivered. 

Each signal is of a distinct frequency in this case. To prevent the transmissions from overlapping, the channel is frequently divided by guard bands, which are strips of unused bandwidth. 

In the case of frequency division multiplexing, if the input signal is digital, it must be converted to analogy before being used as the modulator’s input. 

Frequency Division Multiplexing (FDM) is a type of frequency division multiplexing 

The transmission line in FDM is separated into three segments, each of which represents a channel that carries one transmission, as shown in the diagram above. 

Advantages of FDM 

The following are some of the benefits and advantages of using FDM multiplexing: 

  • It is simple to send a huge number of signals at the same time. 
  • FDM multiplexing demodulation is simple. 
  • The transmitter and receiver do not need to be synchronized for proper functioning. 
  • When gradual narrowband fading occurs, just one channel is affected. 

Disadvantages of FDM

There are a few disadvantages of using FDM, few of them are listed as follows;

  • The bandwidth of communication lines must be quite large. 
  • When employing FDM, there is a problem called crosstalk. 
  • When wideband fading occurs, it affects all channels in the FDM. 
  • A vast number of filters and modulators are required. 

Application of FDM 

The following are the most common FDM applications:

  • AM and FM radio broadcasting are one of the principal applications of FDM. 
  • The usage of FDM in television broadcasting is another use.
  • First-generation cellular telephones also employ FDM.

Must Read ➜ What is Cyclic Redundancy Check (CRC)?

2. Wavelength-Division Multiplexing (WDM)

WDM or Wavelength-Division Multiplexing is an analogy technology based on the wavelength-division technique. This method is comparable to FDM. 

Wavelength Division multiplexing allows distinct signals, such as optical or light signals, to be delivered across an optical Fiber. The high data rate capabilities of optical Fiber cable are leveraged using the WDM technology. 

Various light waves from various sources are merged into a composite light signal, which is then delivered over the channel to the receiver using this approach. 

With the help of a Demultiplexer, this composite light signal is split down into distinct light waves on the receiver side. 

The use of prisms aids in the process of mixing and splitting light waves. This prism aids in the bending of a light beam based on its angle of incidence and frequency. 

The Prism is the principal multiplexer in the WDM technology, and it combines the numerous optical signals to generate a composite signal, which is subsequently delivered through an optical fiber connection. 

Advantages of WDM

The following are some of the benefits and advantages of using WDM multiplexing: 

  • Full-duplex transmission is feasible with the help of WDM. 
  • WDM is simple to set up. 
  • WDM allows several signals to be broadcast at the same time. 
  • This method is less expensive, and it is simple to expand the system. 
  • This method ensures a high level of security. 
  • Because optical fiber is used in WDM, optical components are more dependable and provide more bandwidth. 

Disadvantages of WDM

There are a few disadvantages of utilizing WDM:

  • Because optical equipment is used, the cost rises. 
  • Because bandwidth utilization might be wasteful, wavelength adjustment can be challenging. 
  • The biggest issue with this method is scalability. 

Must Read ➜ Data Link Layer in OSI Model

3. Time-Division Multiplexing (TDM)

Time-Division Multiplexing (TDM) is a technique for combining many channels into a single channel. TDM is a digital multiplexing technique.

  • The channel/link is separated by time rather than the frequency in this strategy. 
  • The total available time on the channel is shared among the many channel users. 
  • Each user on the channel is assigned a time slot/slice, which is a specific time interval. 
  • The data rate capacity in time-division multiplexing should be significantly higher than the data rate required by the transmitting and receiving devices.

Types of TDM-multiplexing

TDM multiplexing is further divided into two types:

(i) Synchronized TDM 

(ii) Asynchronous TDM 

(i) Synchronous Time-Divison Multiplexing (STDM)

Even though the input link is not providing data, it has an allocation in the output in Synchronous TDM. 

Each device is allocated the same time slot to transmit data over the link, regardless of whether it needs to send data to the receiver. 

 Each device sends data to the link when its time slot comes, so control is passed from one device to the next. 

In the event that any devices do not have any data to communicate, the time slot for that device remains unfilled. 

There are ‘n’ sending devices, then there will be ‘n’ time slots available at the same time, which means a one-time slot for each device. 

Time slots are also grouped into frames, with each frame including one or more time slots. 

Advantages of Synchronous (STDM)
  • This approach is simple to use. 
  • Using this strategy, you may be sure of a good result. 
Disadvantages of Synchronous (STDM)
  • If a user does not have any data to transmit, time slots will be squandered. 
  • The transmission link’s capacity must always be greater than the total capacity of the input lines in this multiplexing. 

(ii) Asynchronous Time-Division (StatMUX)

Asynchronous is another type of TDM, time-division multiplexing. 

Asynchronous TDM is also known as Statical Time Division Multiplexing. Now let’s have a look at the advantages and disadvantages of Asynchronous TDM

Advantages of StatMUX
  • Time slots are not set in this case; instead, time slots are allocated dynamically to increase bandwidth efficiency.
  • The combined speed of all input lines may be more than the path’s capacity. 
  • There are n input lines and m slots in this Multiplexing, hence it is always a (mere) efficient use of transmission capacity. 
Disadvantages of StatMUX
  • Frames of various sizes are used in this Multiplexing. 
  • Because there are no different slots given to each user, the buffer address information is also required. 
  • This method does not guarantee a specific waiting time. 

Cyclic Redundancy Check (CRC) for Data Error Detection (With Example)

0

Bits can be corrupted while being transported over a computer network owing to interference and network difficulties. Errors are caused by corrupted bits, which cause the receiver to receive erroneous data. Parity Check, Checksum, and Cyclic Redundancy Check (CRC) are the three basic approaches for detecting flaws in data frames Cyclic Redundancy Check (CRC).

Error detection techniques are in charge of determining whether or not an error occurred in the frame that was transmitted across the network. The number of error bits and the type of mistake are not taken into account. 

The sender must send some extra bits in addition to the data bits in order to detect errors. Based on the additional redundant bits, the receiver performs appropriate checks. If the data is error-free, the unnecessary bits are removed before the message is passed to the top layers.

Cyclic Redundancy Check Meaning

A cyclic redundancy check (CRC) is an error-detection code that is extensively used in digital networks and storage devices to detect unintentional data changes. A short check value is applied to blocks of data entering these systems, based on the remainder of a polynomial division of their contents.

The calculation is performed upon retrieval, and if the check values do not match, corrective action against data corruption can be done.

Cyclic Redundancy Check CRCs can be used to repair errors (see bit filters).  

The algorithm is based on cyclic codes, and the check (data verification) value is a redundancy (it increases the message without adding information). CRCs are popular because they are straightforward to construct in binary hardware, mathematically evaluate, and are particularly good at identifying typical errors caused by noise in transmission channels.

The function that generates the check value is sometimes employed as a hash function because it has a defined length.

Cyclic Redundancy Check Program

Data error Cyclic Redundancy Check calculation

The theory of cyclic error-correcting codes underpins CRCs. W. Wesley Peterson proposed the use of systematic cyclic codes, which encrypt messages by adding a fixed-length check value, for the purpose of error detection in communication networks in 1961. 

Cyclic codes are not only simple to use but are also ideally adapted to detecting burst errors, which are contiguous sequences of erroneous data symbols in communications. Burst faults are common transmission faults in many communication channels, including magnetic and optical storage technologies, therefore this is crucial.  

An n-bit Cyclic Redundancy Check CRC applied to a data block of any length will typically identify any single error burst not longer than n bits, with (1 2n) being the percent of all longer error bursts it will detect. 

The definition of a so-called generator polynomial is required for the specification of a CRC code. This polynomial is used as the divisor in a polynomial long division, in which the message is used as the dividend, the quotient is discarded, and the remainder is used as the result.  

The crucial caveat is that because the polynomial coefficients are produced using finite field arithmetic, the addition operation can always be done bitwise parallel (there is no carry between digits). 

In practice, all commonly used CRCs use the Galois field, or, to put it another way, a two-element finite field, GF (2). The two parts are commonly referred to as 0 and 1, which is a good match for computer architecture. 

When the check value of a CRC is n bits long, it is referred to as an n-bit CRC. Multiple CRCs with different polynomials are conceivable for a given n. This polynomial has the maximum degree n, implying that it has n + 1 terms. 

In other words, the polynomial is n + 1 bits long and requires n + 1 bits to encode. Because the MSB and LSB are always 1 in most polynomial specifications, they are usually omitted. The CRC and related polynomial are usually referred to as CRC-n-XXX, as shown in the table below. 

The parity bit, the simplest error-detection scheme, is actually a 1-bit CRC: it employs the generator polynomial x + 1 (two terms) and is known as CRC-1.

Must Read ➜ What is HTTP?

Data Error Cyclic Redundancy Check (CRC)

CRCs are meant to safeguard against common sorts of mistakes on communication channels, where they can provide speedy and reasonable assurance of message integrity. They are not, however, enough for preventing data tampering on purpose. 

To begin with, because there is no authentication, an attacker can change a message and recompute the CRC without being discovered. CRCs and cryptographic hash functions, while stored alongside data, do not protect against purposeful data change. 

Cryptographic authentication measures, such as message authentication codes or digital signatures, must be used by any application that requires protection against such assaults (which are commonly based on cryptographic hash functions). 

Second, unlike cryptographic hash functions, the CRC function is easily reversible, making it unsuitable for use in digital signatures. 

One more thing is that CRC is a linear function.

As a result, even if the CRC is encrypted with a stream cipher that uses XOR as its combining operation (or a mode of a block cipher that effectively turns it into a stream cipher, such as OFB or CFB), the message and its associated CRC can be manipulated without knowing the encryption key; this was one of the well-known design flaws of the Wired Equivalent Privacy (WEP) protocol. 

CRC based Encoding 

The size of the communication block and the CRC divisor is agreed upon by the communicating parties. CRC (7, 4) is one example of a block, with 7 being the total length of the block and 4 being the number of bits in the data segment. 1011 is a possible divisor. 

The data segment is binary divided by the divisor by the sender. 

The remaining CRC bits are then appended to the end of the data segment. As a result, the generated data unit is divisible by the divisor exactly.

Must Read ➜ Application Layer Protocols

The process of Decoding

The divisor is used by the receiver to divide the incoming data unit 

The data unit is assumed to be correct and accepted if there is no residual. 

Otherwise, it’s assumed that the data is tainted and will be discarded. The receiver may then send the sender an incorrect acknowledgment for retransmission.

Physical Layer in OSI Model: Functions, Issues, Protocols & Device

0

Open System Interconnection (OSI) Model has seven-layer and Physical Layer is the lowest layer and is concerned with wiring and electrical standards. It provides an unreliable bit transmission/reception service to the Data Link layer. Here in this article, we have shared what are the functions of the Physical layer and other basic details about this layer.

What is Physical Layer in OSI Model?

physical layer in osi model

The physical layer is the lowest layer in the 7 layers of the OSI model. It is in charge of transmitting messages and data from one computer to another.

Physical Layer isn’t concerned with the meaning of the bits; instead, it’s concerned with the physical connection to the data link network, as well as signal transmission and reception.

7 Layers of OSI Model

Physical Layer Protocols

  • A physical protocol is a set of rules that governs the data communications between computers on a network.
  • Networking Protocols and rules include guidelines that regulate the characteristics of a network such as access method, allowed physical topologies, types of cabling, and speed of data transfer.
  • Examples of Physical layer protocols include Fiber cables, Integrated Services Digital networks, Ethernet, Universal Serial Bus(USB), Bluetooth, Controller Area Network.

In the OSI model, the physical layer interacts with actual hardware and signaling mechanisms. The physical layer of the OSI network model is the only one that deals with the physical connection between two separate stations.

This layer specifies the hardware, cabling, wiring, frequencies, and pulses that are utilized to represent binary signals, among other things. 

The Data-link layer receives services from the Physical layer. They are converted to electrical pulses, which represent binary data, by the physical layer. After that, the binary data is transferred across the wired or wireless medium.

Transmission Media in Physical Layer

Transmission media refers to the medium used to send data between two computer systems. There are two types of transmission media. 

  • Guided Media – Copper wire, Fiber optic cables
  • Unguided Media – wireless (Radio-frequency, Microwave)

Guided Media

All communication wires/cables, such as UTP, coaxial cables, and fiber optics, are guided media. The sender and receiver are directly connected in this medium, and data is sent (directed) through it. 

Unguided Media

Because there is no connection between the transmitter and receiver, wireless or open air space is considered unguided media. Information is disseminated across the air, and anyone, including the intended recipient, can acquire it.

Must Read ➜ Application Layer Protocols

Messages in Physical Layer

Data must first be transformed into electromagnetic signals before being delivered via physical media. Data might be analogs, such as human speech, or digital, such as a disk file. Digital and analog signals can be used to represent both analog and digital data. 

Digital Signals in Analog Signals

Digital signals are discrete and consist of a series of voltage pulses. Within the circuitry of a computer system, digital signals are utilized. 

In nature, analog signals have the shape of a continuous wave and are represented by continuous electromagnetic waves.

Transmission Impairment in Data Communication

Signals tend to decay as they travel across the medium. This could be due to a variety of factors, including the following: 

Attenuation of sound

  • The signal must be powerful enough for the receiver to accurately comprehend the data. 
  • When a signal travels through a medium, it becomes weaker. 
  • It loses strength as it travels further. 
  •  The dispersion of information 
  • Signals tend to spread and overlap as they travel through the media. The amount of dispersion is determined by the frequency. 

Distortion due to delay

Signals are conveyed at a predetermined pace and frequency across media. If the transmission speed and frequency do not match, the signal may arrive at its destination in an unpredictable manner. It is crucial in digital media that some bits arrive before those that have already been delivered. 

Make a lot of noise

Noise in signal is a random disturbance or fluctuation in an analog or digital transmission that might affect the real information being transmitted. Noise is classified into one of the following categories: 

Noise from the Heat

Heat agitates a medium’s electronic conductors, perhaps introducing noise. Thermal noise is unavoidable up to a certain point. 

Intermodulation is a phrase used to describe the process of When various frequencies use the same medium, interference can result in noise. When two different frequencies share a medium and one of them has excessive strength or the component itself isn’t working properly, intermodulation noise arises, and the resultant frequency may not be transmitted as planned. 

Interactions

When a foreign signal enters the media, this type of noise occurs. This is because the signal in one medium influences the signal in the other. 

Awakening

Unusual disturbances, such as lightning, electricity, short-circuits, or malfunctioning components, generate this noise. This type of noise primarily affects digital data.

Must Read ➜ Data Link Layer in OSI Model

Physical Layer Devices

Almost all electrical and communication devices have a bottom layer of the OSI Model that is the Physical layer. Some of the devices are as follows;

  • Hub: is a centralized device that connects many devices to share data.
  • Repeater: device regenerates the signal which is corrupted due to long distance. These signals may be electrical wireless or optical in nature.
  • Switch: is a simple device that connects many other devices together to make a network.
  • Bridge: device creates a single aggregate network from multiple communication networks
  • Modem: word stands for Modulator-Demodulator. The Modulator is to convert a digital signal to analog and Demodulation converts analog signals back to digital.
  • Personal computers, laptops, Mobile phones, telephones or cables, etc are also devices use for data communication.

Physical Topologies

Physical Topology simply means how the devices are connected to make a network. Some important physical topologies are as follows;

  • Mesh topology
  • Ring topology
  • Bus topology
  • Star topology
  • Hybrid topology

Functions of Physical Layer:

The Physical layer of the OSI model is responsible for the following functions. 

Bit Representation: The data in this layer is represented as a stream of bits. For transmission, the bits must be encoded into signals. It specifies the type of encoding, or how the 0s and 1s are converted into signals. 

Data Rate: This layer specifies the transmission rate, which is expressed in bits per second. 

Synchronization is the process of ensuring that the transmitter and receiver are in sync. At the bit level, the sender and receiver are synced. 

The transmission interface between devices and the transmission media is defined by the physical layer. 

Line Configuration: This layer connects devices to the media in two ways: point to point and multipoint. 

Mesh, Star, Ring, and Bus are the topologies that must be used to link devices. 

Physical Layer determines the transmission direction between two devices: simplex, half-duplex, and full-duplex. 

  • It is concerned with the transmission of baseband and broadband data. 
  • In the ISO-OSI Model, there is a physical layer.

Must Read ➜ TCP/IP & Transport Layer in OSI Model

Physical Layer Issues in Design Of OSI Model:

The Physical Layer is responsible for sending raw data across a communication connection. 

The design difficulty is ensuring that when one side delivers a 1 bit, the other side receives it as a 1 bit rather than a 0 bit. 

 Most common inquiries in the physical layer Of the OSI Model :

  • How many volts should a 1 bit be represented by, and how many should a 0 be represented by? 
  • How long does a bit last in nanoseconds? 
  • Is it possible to transmit data in both ways at the same time? 
  • Is it possible to transmit data in both ways at the same time? 
  • What are the functions of each of the network connector’s pins? 

Mechanical, electrical, and temporal interfaces, as well as the physical transmission channel under the physical layer, are the main design concerns. 

The capacity of the Channel:

The channel capacity refers to the rate at which data is transmitted. In the digital realm, we refer to it as data rate. It is determined by a number of factors, including: 

  • Bandwidth refers to the physical capacity of the underlying media. 
  • Error-rate: Incorrect information reception due to noise. 
  • The number of levels employed for signaling is referred to as encoding. 

TCP/IP Model (Internet Protocol Suite): Functions, ICMP, Transport Layer

0

TCP/IP Model stands for Transmission Control Protocol/Internet Protocol Model. The TCP/IP model contains four layers from the seven layers of the OSI model. Hence it is known as a concise version of the OSI model.

In this article, we have shared all the basic information about the TCP/IP Model such as the function of the TCP/IP Model.

Internet Protocol Suite: TCP/IP Model

four layers in tcp ip model

TCP/IP Model is also known as the Internet Protocol Suite because it is the set of communications protocols used in the Internet and similar computer networks.

The current main protocols in the suite are the Transmission Control Protocol and the Internet Protocol.

Each layer within the Internet Protocol Suite has a specific function. When all these layers of the TCP/IP model are combined and transmitted, communication between systems can occur.

Four primary layers of the TCP/IP Model are as follows;

  • Application Layer,
  • Transport Layer,
  • Network Layer, and
  • Internet (Link) layers.

The TCP/IP Model came first, followed by the OSI model. The TCP/IP Model and the OSI model are not identical. The application layer, transport layer, network layer, data link layer, and physical layer are the layers of the TCP/IP Model.

The first four levels, which correspond to the first four layers of the OSI model, including physical standards, network interface, inter-networking, and transport services, and these four layers are represented in the TCP/IP paradigm by a single layer termed the application layer.

TCP/IP is a hierarchical protocol made up of interacting modules, each of which has its own set of features. 

Hierarchical refers to the fact that each upper-layer protocol is backed up by two or more lower-layer protocols.

Must Read ➜ What is HTTP?

TCP/IP Model Layers Functions

tcp ip model layer functions

TCP/IP Model layers have the following functions:

Application Layer Function in TCP/IP Model:

  • During a communication session, both the source and destination devices use application layer protocols.
  • The application layer protocols deployed on the source and destination hosts must match for the communications to be successful.

Must Read ➜ Application Layer Protocols

Transport Layer Function in TCP/IP Model

  • It specifies how data should be physically transmitted through the network. 
  • This layer is primarily in charge of data transfer between two devices on the same network. 

Network/Internet Layer function in TCP/IP Model:

  • Encapsulating IP datagrams into network frames and translating IP addresses to physical addresses are two of the services performed by this layer. 
  • Ethernet, token ring, FDDI, X.25, and frame relay are the protocols used by this layer. 
  • The second tier of the TCP/IP Model paradigm is the internet layer. 
  • The network layer is another name for the internet layer. 
  • The internet layer’s primary function is to send packets from any network to their destination, regardless of the route they take.

Data Link or Network Access Layer Function in TCP/IP Model 

  • The TCP/IP model’s lowest layer is the network layer. 
  • The OSI reference model defines a network layer as a mixture of the Physical and Data Link layers.

Must Read ➜ Data Link Layer in OSI Model

TCP/IP Model Layers Protocols:

The protocols used at layers in TCP/IP Model are as follows: 

IP Protocol: This layer employs the IP protocol, which is the most important component of the TCP/IP suite. 

This protocol’s obligations are as follows: 

IP Addressing: This protocol implements IP addresses, which are logical host addresses. The internet and higher layers employ IP addresses to identify devices and to provide internetwork routing. 

The path along which data is to be transferred is determined by host-to-host communication. 

Data Encapsulation and Formatting: The data from the transport layer protocol is accepted by an IP protocol. An IP protocol wraps data into a message known as an IP datagram and ensures that it is transferred and received securely. 

Fragmentation and Reassembly: The Maximum Transmission Unit (MTU) is the size limit set by the data link layer protocol on the size of an IP datagram (MTU). If the size of an IP datagram exceeds the MTU unit, the IP protocol divides the datagram into smaller units for transmission across the local network.

The sender or an intermediary router can fragment data. All of the fragments are reassembled at the receiver’s end to make an original message. 

Direct delivery occurs when an IP datagram is transferred via the same local network, such as a LAN, MAN, or WAN. The IP datagram is transferred indirectly when the source and destination are on a different network. The IP datagram can be routed through multiple devices, such as routers, to do this.

ARP Protocol: ARP Protocol is a protocol that allows you to communicate with Address Resolution Protocol (ARP) is an acronym for Address Resolution Protocol. 

ARP is a network layer protocol for determining a physical address based on an IP address. 

The ARP Protocol is mostly connected with the two terms: 

ARP request: When a sender wants to know the device’s physical address, it sends an ARP request to the network. 

ARP reply: Every network device will receive and process the ARP request, but only the recipient will identify the IP address and respond with its physical address in the form of an ARP reply. The physical address is added to the recipient’s cache memory as well as the datagram header.

Must Read ➜ Types of Routing Protocols

Internet Controlled Messaging Protocol (ICMP) 

The Internet Control Message Protocol (ICMP) stands for Internet Control Message Protocol. 

It is a method used by hosts or routers to communicate back to the sender notifications about datagram errors. 

Until it reaches its destination, a datagram goes from router to router. The ICMP protocol is used to alert the sender that the datagram is undeliverable if a router is unable to route the data due to unexpected conditions such as disabled links, a device on fire, or network congestion. 

The most common terms used in an ICMP protocol are: 

ICMP Test: The ICMP Test is used to determine whether or not a destination can be reached. 

ICMP Reply: The ICMP Reply command is used to determine whether or not the destination device is responding. 

The ICMP protocol’s primary function is to notify problems rather than to solve them. The sender bears responsible for the adjustment. 

Because the IP datagram carries the addresses of the source and destination but not of the router to which it is sent, ICMP can only transmit messages to the source and not to intermediate routers. 

Transport Layer In TCP/IP Model 

  • The transport layer is in charge of data dependability, flow control, and correction as it travels through the network. 
  • User Datagram Protocol and Transmission Control Protocol are the two protocols utilized in the transport layer. 

 The User Datagram Protocol (UDP) is a protocol that allows (UDP) 

  • It delivers a connectionless service as well as end-to-end transmission delivery.  
  • It’s a shaky protocol since it detects mistakes but doesn’t tell you what they are. 
  • The error is discovered by the User Datagram Protocol, and the ICMP protocol informs the sender that the user datagram has been corrupted. 

The fields that make up UDP are as follows: 

  • The address of the application software that created the message is known as the source port address. 
  • The address of the application software that receives the message is known as the destination port address. 

Transmission Controlling Protocol (TCP):

  • It provides apps with full transport layer services. 
  • It establishes a virtual circuit between the sender and the receiver, which remains active throughout the communication. 
  • TCP is a dependable protocol since it detects errors and retransmits the frames that have been damaged. As a result, before the transmission is considered complete and a virtual circuit is deleted, all segments must be received and acknowledged. 
  • TCP breaks the entire message into smaller units known as segments at the sending end, and each segment contains a sequence number that is used to arrange the frames to form the original message. 
  • TCP takes all segments and reorders them depending on sequence numbers at the receiving end. 

Hypertext Transfer Protocol (HTTP): HTTPS Difference, Work, Type, Proxy

0

HTTP full form is Hypertext Transfer Protocol, which is an application layer network protocol built on top of TCP. HTTP provides a standard for web browsers and servers to communicate.

Hypertext Transfer Protocol defines how computers send packets of data to each other.

In this article, we have shared all the basic information about HTTP and how it works, Types of Hyperlink transfer protocols. what is the difference between HTTP and HTTPS?

So let’s start with the basic topic like what is HTTP?

What is HTTP? (Hypertext Transfer Protocol)

what is hypertext transfer protocol

HTTP (Hypertext Transfer Protocol) is a set of rules for moving data over the internet, including text, photos, audio, video, and other multimedia files. HTTP is used indirectly as soon as a person opens their web browser.

HTTP is an application protocol that runs on top of the TCP/IP protocol stack, which is the internet’s basics.

HTTP/2, which was released in May 2015, is the most recent version of HTTP. It is a replacement for HTTP 1.1, although it does not render HTTP 1.1 obsolete.

Must Read ➜ Application Layer Protocols

How does HTTP (Hypertext Transfer Protocol) work? 

Resources are exchanged between client devices and servers via the internet via the HTTP protocol. Client devices make requests to servers for the resources required to load a web page, and the servers respond with replies that satisfy the requests.

  • Sub-documents — such as data on pictures, text, text layouts, and so on — are shared between requests and responses and are stitched together by a client web browser to show the whole web page file. 
  • A web server contains an HTTP (Hypertext Transfer Protocol) daemon, a software that waits for HTTP requests and handles them when they arrive, in addition to the web page files it can serve.
  • A web browser is an HTTP client that communicates with servers by sending requests.
  • When a browser user requests a file by typing in a URL or clicking on a hypertext link, the browser generates an HTTP request and delivers it to the Internet Protocol address (IP address) provided by the URL.
  • The request is received by the HTTP (Hypertext Transfer Protocol) daemon on the destination server, which then delivers back the requested file or files. 
  • HTTP is the protocol used by client devices to communicate with servers online and access web pages. 

To continue with this example, a user would like to go to Google.com When the user puts in a web address, the computer sends a “GET” request to the server that hosts the URL.

The GET request uses HTTP to inform the TechTarget server that the user is looking for the HTML (Hypertext Markup Language) code that structures and gives the login page its appearance.

The login page’s text is included in the HTML response, but other elements of the page, particularly its graphics and videos, are retrieved and returned separately via HTTP requests and responses.

The more calls made — for example, to call a page with many images — the longer it takes the server to answer and the user’s system to load the page. 

TCP/IP is used to reduce and transmit information in small packets of binary sequences of ones and zeros when these request/response pairs are sent.

Electric wires, fiber optic cables, and wireless networks are used to send these messages. 

ASCII code is used in the requests and responses that servers and clients utilize to communicate data. Requests specify what data the client wants from the server, while answers contain code that the client’s browser will interpret as a web page. 

HTTP vs. HTTPS: What’s the Difference?

http vs. https

Under conventional HTTP application layering, HTTPS is the use of Secure Sockets Layer (SSL) or Transport Layer Security (TLS) as a sublayer.

HTTP encrypts and decrypts either user HTTP page requests and the web server’s response pages. Eavesdropping and man-in-the-middle (MitM) attacks are likewise protected.

Netscape was the first to implement HTTPS. Migrating from HTTP to HTTPS is advantageous because it adds a layer of security and trust.

Must Read ➜ Congestion Control

Requests and replies through HTTP(Hypertext Transfer Protocol) 

A message is a name given to each interaction between the client and the server. HTTP requests and answers are both messages.

Client devices transmit HTTP requests to servers, which then respond with HTTP responses to the clients. 

HTTP requests are made. This occurs when a client device, like an internet browser, requests information from the server in order to load a webpage. The request gives the server the information it needs to customize the server’s response to the client device.

Each HTTP request comprises encoded data, including the following: 

After then, the specific version of HTTP was used.

The two versions :

  • HTTP 
  • HTTP/2

A web address. This is a hyperlink to a web resource. 

This is an HTTP method. This specifies the particular action that the request wants the server to take in response. 

Headers of HTTP requests. This information contains things like the browser being used and the data the request is looking for from the server. Cookies, which show information previously sent from the server handling the request, can also be included. 

The body of an HTTP request. This is optional information that the server needs from the request, such as user forms that are sent to the website, such as username/password logins, short responses, and file uploads. 

Responses to HTTP requests. The data received by a client device from the webserver is represented by the HTTP response message. The response is the server’s answer to an HTTP request, as the name implies.

The information in an HTTP response is adapted to the context provided by the request to the server. The following information is commonly included in HTTP responses: 

The HTTP status code informs the client device about the status of the request. Success, an informative answer, a redirect, or faults on the server or client-side are all possible responses. 

Headers in HTTP responses that send information about the server and the resources requested. 

The body of an HTTP request (optional). If a request is successful, the response contains the requested data in the form of HTML code, which the client browser converts into a web page.

Must Read ➜ Types of Routing Protocols

Status codes on the HTTP protocol 

Servers frequently send response codes in response to HTTP requests, indicating whether the request is being processed, whether there was an error in the request, or whether the request is being redirected. The following are examples of common response codes: 

  •  OK with 200. This indicates that the request, such as GET or POST, was successful and is being processed. 
  •  300 has been permanently relocated. This response code indicates that the requested resource’s URL has been permanently changed. 
  •  the number 401 Unauthorized access. The client, or the person who is making the server request, has not been authenticated. 
  •  Forbidden with a 403 code. The client’s identity is known, but no access authorization has been granted. 
  •  There was a 404 error. This is the most common type of error code. It indicates that the URL is invalid or that the resource at the specified address does not exist. 
  •  Internal Server Error 500 The server has come upon a circumstance that it is unsure how to handle. 

 Proxies in the HTTP protocol 

Application-layer servers, computers, or other entities that sit between the client device and the server are known as proxies or proxy servers.

Proxies act as a conduit between the client and the server, relaying HTTP requests and responses. For each client-server interaction, one or more proxies are often used. 

Proxies can be either transparent or opaque. Transparent proxies do not alter the client’s request and instead relay it to the server unchanged. Client requests will be modified in some way by non-transparent proxies.

Non-transparent proxies can be used for a variety of purposes, including speeding up server retrieval. 

Proxies can be used by web developers for the following purposes: 

  • Caching is a term that refers to the act of Cache servers can save web pages and other internet content locally, allowing for faster content retrieval and lower bandwidth usage. 
  •  Authentication is the process of verifying someone’s identity. Controlling application and internet information access privileges. 
  • Logging is a type of data collection. Historical data, such as the IP addresses of clients that made queries to the server, is saved. 
  •  Filtering of the internet. Controlling access to online pages that may pose a security risk or contain offensive information. 
  •  Load balancing is a term that refers to the process of balancing the Multiple servers, rather than just one, that can manage client requests to the server.

Application Layer Protocols: Types & Example (HTTP, DNS, SMTP, FTP)

0

In this article, we have shared all the basic information about Application Layer Protocols with their types, examples, uses, and functions of protocols in the application layer of the OSI Model.

What are Application Layer Protocols?

At the top of the OSI model is the Protocols application layer. It’s the layer that allows users to engage with each other. It helps the user by providing services. 

An application layer is an outermost and 7th layer in the OSI Model and it is the human interaction layer, where applications can access the network services. Application layer protocols define messages exchanged by apps and actions taken.

In other words, Application layer protocols define rules when implementing specific network applications.

An application layer protocol, in particular, specifies:

  • The sorts of messages, such as to request and response messages. 
  • The fields in the message and the syntax of the various message types 

How the fields are marked out: 

  • The semantics of the fields, that is, the meaning of the data that the fields contain. 

The field is expected to be able to hold:

  • Message-sending rules that determine when and how a process sends messages 

Replies to incoming messages:

  • The request specifies many Internet application-layer protocols in detail.

RFCs are Requests for Comments documents that are in the public domain. 

  • The HTTP 1.1 standard, for example, is included in RFC 2068, which was published in 1998. 

January 1997, the project was completed and made public. 

  • If a browser (HTTP client) developer adheres to the HTTP 1.1 RFC’s guidelines, 

The browser will be able to retrieve Web pages from any Web server that has been configured to accept HTTP requests has also adhered to the HTTP 1.1 RFC’s standards.

Must Read ➜ Congestion Control

Types of Application Layer Protocols:

types of protocols in application layer

There are various types of protocols for the Application layer. Some major protocols are as follows;

  • TELNET (telephone network)
  • FTP (File Transfer Protocol)
  • TFTP (Transfer File Transfer Protocols)
  • NFS (National Football System)
  • SMTP (Simple Mail Transfer Protocols)
  • LPD (Leave No Trace)
  • The X-window
  • SNMP (Simple Network Management Protocol)
  • DNS (Domain Name System)
  • DHCP (Domain Name System)

1. TELNET (telephone network): 

The telecommunications network is referred to as Telnet. It is beneficial to terminal emulation. It enables Telnet clients to use the Telnet server’s resources. It’s used to keep track of files on the internet. It’s used to set up devices like switches for the first time. The telnet command is a command that communicates with a remote device or system using the Telnet protocol. Telnet’s port number is 23. 

The command 

telnet [\\RemoteServer] 

Remote server:

Specifies the name of the server you want to connect to. 

2. FTP (File Transfer Protocol):

The file transfer protocol is abbreviated as FTP. It is the protocol that allows us to send and receive files. This can be done between any two machines that use it. FTP, on the other hand, is both a protocol and an application. FTP allows users to share files with others over the internet using a secure and efficient data transfer protocol. For FTP, the data port is 20 and the control port is 21. 

The command 

FTP machine name 

3. TFTP (Transfer File Transfer Protocols):

The Trivial File Transfer Protocol (TFTP) is a stripped-down, stock version of FTP, but it’s the protocol to use if you know exactly what you’re looking for and where to look for it. It’s a simpler form of FTP that allows you to transfer files between network devices. 

The command 

tftp [ options... ] [host [port]] [-c command]

4. NFS (National Football System):

The acronym NFS stands for the network file system. 

It allows remote computers to mount file systems across a network and interact with them as if they were locally mounted. This allows system administrators to consolidate resources on the network’s centralized servers. 

The command 

service NFS start 

5. SMTP (Simple Mail Transfer Protocols):

Simple Mail Transfer Protocol is the abbreviation for Simple Mail Transfer Protocol. The TCP/IP protocol includes it. SMTP transmits your email on and across networks via a procedure known as “store and forward.” It collaborates with the Mail Transfer Agent (MTA) to deliver your message to the correct computer and email mailbox. The SMTP port number is 25. 

The commands 

MAIL FROM:<[email protected]? 

6. LPD (Leave No Trace):

  • The acronym LPD stands for Line Printer Daemon. 
  •  It’s made for shared printers. 
  •  It’s the section that takes the request and processes it. A server or agent is referred to as a “daemon.”

The command 

lpd [ -d ] [ -l ] [ -D DebugOutputFile]

7. The X-window

It specifies a protocol for creating client/server applications with a graphical user interface. The concept is to execute an application called a client on a single machine. It’s mostly utilized in interconnected mainframe networks.  

The command 

Run xdm in run level 5 

8. SNMP (Simple Network Management Protocol): 

Simple Network Management Protocol is the abbreviation for Simple Network Management Protocol. It collects data by polling the devices on the network. 

The network at specified or random intervals from a control station, needing 

 They are required to reveal specific details. It’s a mechanism for servers to share information about their present status, as well as a mechanism for administrators to change pre-defined settings. The SNMP port numbers are 161 (TCP) and 162 (UDP) (UDP). 

 The command

snmpget -mALL -v1 -cpublic snmp_agent_Ip_address sysName.0 

9. DNS (Domain Name System):

Every time you use a domain name, a DNS provider must translate the name into an IP address. The domain name www.abc.com, for example, could be translated to 198.105.232.4. 

The DNS port number is 53. 

The command

ipconfig /flushdns 

10. DHCP (Domain Name System): 

Dynamic Host Configuration Protocol is an acronym for Dynamic Host Configuration Protocol (DHCP). 

It assigns IP addresses to servers. 

When a computer registers for an IP address with a DHCP server, the DHCP server can offer a lot of information to the host. The DHCP port numbers are 67 and 68. 

The command 

clear ip dhcp binding {address | * } 

Must Read ➜ Types of Routing Protocols

Functions of the Application Layer Protocols

During a communication session, both the source and destination devices use application layer protocols. The application layer protocols deployed on the source and destination hosts must match for the communications to be successful. 

Protocols carry out the following functions: 

  • Create a set of rules for transferring data between applications and services that have been loaded. on the devices that are taking part 
  • Specify the structure of the data contained in the messages, as well as the sorts of messages that are sent. 
  • Between the source and the destination, These messages could be service requests, for example. 
  • Acknowledgments, data messages, status messages, or error messages are all examples of messages. 
  • Define message dialogues to ensure that a message is received by the intended recipient. 
  • When data is transferred, ensure that the appropriate services are activated. 
  • Across data networks, many different types of applications communicate. As a result, the application 
  • To deliver the appropriate breadth of communication experiences, layer services must implement several protocols. Each protocol serves a certain purpose and has the features listed below. 
  • Required to achieve that goal Each layer’s protocol details must be followed in order for this to work. 
  • Ensure the functions on one layer communicate with the services on the lower tier properly. 
  • In the course of a single communication, applications and services can use different protocols. One protocol may specify how to create a network connection, while another may explain how to maintain the connection. 

User Datagram Protocol: UDP Vs TCP, Work, Header, Use, DDoS Attacks

0

User Datagram Protocol, in short UDP, is one of the core members of the Internet protocol suite In computer networking.

Computer applications can send messages with the help of UDP. It is referred to as datagrams, to other hosts on an Internet Protocol network.

In this article, we have shared all the basic information, functions, and applications of the User Datagram Protocol. We have also answered questions like how important is UDP in mitigating DDoS attacks?

So let’s start our topic with the introduction to User Datagram Protocol.

What is User Datagram Protocol?

what is user datagram protocol

User Datagram Protocol (UDP) is a component of the Internet Protocol suite, also known as the UDP/IP suite. It is an unreliable and connectionless protocol, unlike TCP. As a result, there is no need to establish a connection before transferring data. 

Despite the fact that Transmission Control Protocol (TCP) is the most widely used transport layer protocol for most Internet services, it provides guaranteed delivery, reliability, and much more, all of these benefits come at a cost in terms of overhead and delay.

UDP is used in this case. UDP(User Datagram Protocol) is required for real-time applications such as computer gaming, phone or video communication, and live the conference.

Because great throughput is required, UDP allows packets to be dropped rather than processed. Because UDP does not do error checking, it saves bandwidth. 

In terms of latency and bandwidth, the User Datagram Protocol (UDP) is more efficient. 

UDP Header (Uniform Datagram Protocol)

The UDP header is an 8-byte fixed and simple header, whereas the TCP header can range from 20 to 60 bytes. The first 8 bytes contain the necessary header information, while the remainder is data.

Because each UDP port number field is 16 bits long, the range for port numbers is 0 to 65535; port number 0 is reserved.

Port numbers are used to differentiate between different user requests or processes. 

Source Port: Source Port is a two-byte parameter that identifies the source’s port number. 

Destination Port: This is a two-byte field that identifies the destined packet’s port. 

The length of UDP, including the header and data, is measured in bytes. It’s a field with 16 bits. 

Checksum: The checksum is a two-byte field. It’s the 16-bit one’s complement sum of the UDP header, pseudo-IP header information, and data, padded with zero octets at the end (if necessary) to make a multiple of two octets. 

Notes – Unlike TCP, UDP does not require checksum calculation. UDP does not provide error control or flow control. As a result, UDP relies on IP and ICMP to report errors.

Must Read ➜ Congestion Control

User Datagram Protocol (UDP) Applications include: 

  • When the size of the data is small, there is less concern about flow and error control, hence it is used for simple request-response communication. 
  • Because UDP provides packet switching, it is a good protocol for multicasting. 
  • Some routing update protocols, such as RIP, employ UDP (Routing Information Protocol). 
  • Typically employed in real-time applications where unequal delays between sections of a received message cannot be tolerated.

Use of UDP (User Datagram Protocol)

UDP is used as a transport layer protocol in the following implementations:

  • NTP is a non-profit organization dedicated to (Network Time Protocol) 
  • DNS (Domain Name System) (Domain Name Service) 
  • DHCP, BOOTP 
  • NNP  (Network News Protocol) 
  • Protocol for the Quote of the Day 
  • TFTP, RTSP, and RIP are examples of protocols. 
  • Some tasks can be performed by the application layer via UDP. 
  • Trace Your Steps 
  • Make a note of your route. 
  • Date and time stamp 
  • UDP receives datagrams from the Network Layer, attaches their headers, and sends them to the user. As a result, it operates quickly. 
  • If you delete the checksum field from UDP, it becomes a null protocol. 
  • Reduce the number of computing resources required. 
  • When transferring using Multicast or Broadcast. 
  • Real-time packet transmission, primarily in multimedia applications. 

UDP Process: How does User Datagram Protocol work?

UDP is a defined technique for sending data between two computers on a network, just like all other networking protocols.

UDP performs this task in a straightforward manner as compared to other protocols:

it delivers packets (units of data transmission) immediately to a destination computer without first establishing a connection, identifying the order of such packets, or verifying that they arrived as intended. (Datagrams are the term for UDP packets.) 

TCP, another common transport protocol, is quicker but less dependable than UDP. The two computers in a TCP conversation start by establishing a connection using an automated process known as a “handshake.”

Only once this handshake is complete will one computer begin sending data packets to the other. 

This is not the case with UDP communications. Rather, one computer can just start transferring data to the other:

Must Read ➜ Types of Routing Protocols

TCP vs UDP: Communication Protocols

tcp vs udp communication

TCP communications also specify the order in which data packets should be received and check that they arrive in the correct sequence. TCP specifies that if a packet does not arrive for example, due to congestion in intermediary networks it is resent.

None of this functionality is included in UDP communications. 

These distinctions provide certain advantages. User Datagram Protocol can send data quicker than TCP since it does not require a “handshake” or any checks to ensure that data arrives correctly. 

However, there are costs associated with this speed. A User Datagram Protocol datagram will not be resent if it is lost in transit.

As a result, User Datagram Protocol applications must be tolerant of errors, loss, and duplication. 

(Technically, packet loss is more a result of how the Internet is structured than a problem with UDP. Because doing so would demand an unrealistic amount of additional memory, most network routers do not conduct packet ordering and arrival confirmation by default. When an application requires it, TCP is a technique to bridge the gap.)

Must Read ➜ Recursion Function in Python

What Types Of Services Use UDP? 

User Datagram Protocol is widely employed in time-sensitive communications where losing packets on occasion is preferable to waiting.

This protocol is used to send voice and video traffic because they are both time-sensitive and engineered to handle some loss.

For example, User Datagram Protocol is utilized by VOIP (voice over IP), which is utilized by many internet-based telephone services. This is due to the fact that a staticky phone conversation is better than one that is crystal clear but is much delayed. 

As a result, User Datagram Protocol is an excellent choice for online gaming. DNS servers, likewise, employ UDP since they must be quick and efficient. 

Role of UDP in preventing DDoS attacks

In most use scenarios, UDP’s ‘risks,’ such as packet loss, aren’t a severe issue. UDP, on the other hand, can be used for nefarious reasons.

Because User Datagram Protocol does not require a handshake, attackers can ‘flood’ a targeted server with User Datagram Protocol traffic without first obtaining authorization from that server to communicate. 

A typical User Datagram Protocol flood attack sends a huge number of User Datagram Protocol datagrams to the target computer’s random ports.

This forces the target to respond with an equivalent amount of ICMP packets, indicating that those ports are no longer reachable.

The computational resources necessary to reply to each false datagram can exhaust the target, causing legitimate traffic to be denied service.

Organizations can defend themselves from User Datagram Protocol flood attacks in a number of ways. One alternative is to limit the rate at which ICMP packets respond, albeit this method can also filter out genuine messages.

Another option is to accept and reply to User Datagram Protocol traffic over a network of multiple scattered data centers, which prevents a single origin server from becoming overburdened with false requests.

Congestion control in Computer Networks: Types and Techniques

0

Congestion Control is also known as TCP Congestion control. TCP refers to Transmission Control Protocol that uses a network congestion-avoidance algorithm.

It includes various aspects of an additive increase and multiplicative decrease scheme, along with other schemes including slow start and congestion window, to achieve congestion avoidance.

Today we have shared a brief introduction about congestion control in computer networks, bucket algorithm, process, and technique of congestion control.

What is Congestion Control? 

When message traffic is so intense that network response time is slowed, a condition occurs on the network layer. 

  •  Congestion control Effects 
  •  Performance suffers as the delay lengthens. 
  •  Retransmission occurs as the delay increases, worsening the problem. 
  •  Algorithms for congestion control 
  •  Algorithm for a Leaky Bucket 

Let’s look at an example to help you understand.

Consider a bucket with a small hole in the bottom. The outflow stays constant regardless of the pace at which water enters the bucket. When the bucket is full, any more water entering flows over the sides and is lost. 

 Bucket with a Leak

leaky bucket algorithm

Similarly, each network interface has a leaky bucket, and the leaky bucket method has the following steps: 

  • When the host wishes to send a packet, it is placed in the bucket. 
  • The bucket leaks at a consistent rate, implying that the network interface sends packets at the same rate. 
  • The leaky bucket converts bursty traffic to consistent traffic. 
  • In practice, the bucket is a finite queue with a finite rate of output. 
  • Algorithm for token buckets 

Token Bucket Algorithm in Congestion Control: 

No matter how bursty the traffic is, the leaky bucket method enforces the output pattern at the average rate. So, in order to deal with bursty traffic, a flexible algorithm is required to ensure that data is not lost. Token bucket algorithm is one such algorithm. 

Steps in congestion control algorithm are as follows;

  • Tokens are thrown into the bucket at regular intervals. 
  • The bucket can hold a maximum amount of water. 
  • If a ready packet exists, a token from the bucket is withdrawn, and the packet is dispatched. 
  • The packet cannot be sent if there is no token in the bucket. 

Let’s have a look at an example.

A bucket containing three tokens and five packets awaiting transmission. A packet must capture and destroy one token before it can be broadcast. Three of the five packets have made it through, but the other two are stuck waiting for further tokens to be created, as seen below.

The following are some of the reasons why a token bucket is preferable over a leaky bucket: 

The leaky bucket algorithm is a conservative technique that limits the pace at which packets are introduced into the network. The token bucket algorithm now has some flexibility.

At each tick, algorithm tokens are generated in the token bucket (up to a certain limit).

An incoming packet must capture a token before being transferred, and the transmission must occur at the same rate.

As a result, if tokens are available, part of the busty packets are transmitted at the same rate, giving the system some flexibility. 

 M * s = C + * s = M * s = M * s = M * s = M * s = M * s 

Where, S — denotes the amount of time spent 

M — stands for maximum production rate. 

C — Byte capacity of the token bucket 

Must Read ➜ Recursion Function in Python

Congestion Control Techniques:

congestion control techniques

Congestion control refers to the methods used to reduce or eliminate traffic congestion. Techniques for reducing traffic congestion can be divided into two groups:

  1. Open Loop Congestion Control
  2. Closed Loop Congestion Control

1. Controlling Congestion in an Open Loop

Congestion control rules with an open loop are used to prevent congestion before it occurs. The source or the destination is in charge of congestion control.   

Policy on Retransmission: 

It is the policy that ensures that packets are retransmitted. If the sender believes a packet has been lost or corrupted, the packet must be resent. The network may become more congested as a result of this broadcast. 

Retransmission times must be designed to avoid congestion while also being able to maximize efficiency. 

Policy on Windows: 

Congestion may also be affected by the type of window on the sender side. Although some packets may be successfully received at the receiver side, several packets in the Go-back-n timeframe are resent. This duplication has the potential to worsen the network’s congestion. 

As a result, the Selective Repeat Window should be used since it sends the precise packet that was missed. 

Disposal Policy : 

A useful discarding policy employed by routers is that it allows them to avoid congestion while also partially rejecting corrupted or less sensitive packages while maintaining message quality. 

When transmitting audio files, routers can discard less sensitive packets to avoid congestion while maintaining the audio file’s quality. 

Policy on Acknowledgement: 

Because recognition is a component of network load, the acknowledgment policy imposed by the receiver may have an impact on congestion. Congestion caused by acknowledgment can be avoided using a variety of methods. 

Rather than sending an acknowledgment for a single packet, the receiver should send an acknowledgment for N packets. Only when a packet must be sent or a timer expires should the recipient provide an acknowledgment. 

Admissions Procedures: 

A mechanism should be utilized in admission policy to reduce congestion. Before transmitting a network flow farther, switches in a flow should assess its resource requirements. To avoid further congestion, the router should prohibit establishing a virtual network connection if there is a probability of congestion or if the network is already congested. 

All of the policies listed above are implemented to prevent network congestion before it occurs. 

Must Read ➜ Types of Routing Protocols

2. Congestion Control in a Closed Loop

After congestion has occurred, the closed-loop congestion control technique is employed to treat or alleviate it. Different protocols employ a variety of strategies, including the following: 

Pressure on the back: 

Backpressure is a method of preventing a crowded node from accepting packets from an upstream node. This may lead the upstream node or nodes to become overburdened, preventing data from being received from the above nodes. Backpressure is a congestion control strategy that spreads in the reverse direction of data flow from node to node.

The backpressure approach can only be used on virtual circuits in which each node knows knowledge about the node above it. 

Back stretching :

In the picture above, the 3rd node becomes overcrowded and stops receiving packets, causing the 2nd node to become congested as the output data flow slows. Similarly, the 1st node may become overburdened and alert the source to slow down. 

Technique for Choke Packets: 

Both virtual networks and datagram subnets can benefit from the choke packet strategy. A choke packet is a message delivered by a node to the source informing it that the network is congested. Each router keeps track of its resources and how many of its output lines are in use.

The router sends a choke packet to the source anytime resource use exceeds the threshold value defined by the administrator, giving it feedback to minimize traffic. Congestion is not reported to the intermediate nodes via which the packets passed. 

Packet choke:

Implicit Signaling is a term that refers to a type of signaling that is : 

There is no communication between the congested nodes and the source in implicit signaling. The source speculates that a network is congested. When a sender sends multiple packets and does not receive an acknowledgment for a long period of time, one assumption is that there is congestion. 

Explicit Signaling is a term that refers to a type of signaling that is :

In explicit signaling, if a node encounters congestion, it can send a packet to the source or destination to tell the source or destination about the congestion. The difference between choke packet and explicit signaling is that with explicit signaling, the signal is contained in the data packets rather than creating separate packets as in the choke packet. 

Explicit signaling can take place in either a forward or reverse manner. 

Forward Signaling:

A signal is transmitted towards the direction of the congestion in forwarding signaling. There is a congestion warning for the destination. In this instance, the receiver adopts policies to prevent future congestion. 

Reverse Signaling:

A signal is transmitted in the opposite direction of the bottleneck in backward signaling. The source has been advised to slow down due to traffic congestion.