0% found this document useful (0 votes)
15 views24 pages

Computer Network

This consist basic details for computer network

Uploaded by

kumkumsengar43
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views24 pages

Computer Network

This consist basic details for computer network

Uploaded by

kumkumsengar43
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Question 1: What is the function of transport layers?

Draw the TCP segment header


format and explain its various fields.

Answer: The main aim of transport layer is to be delivered the entire message from source to
destination. Transport layer ensures whole message arrives intact and in order, ensuring both
error control and flow control at the source to destination level. It decides if data transmission
should be on parallel path or single path

Transport layer breaks the message (data) into small units so that they are handled more
efficiently by the network layer and ensures that message arrives in order by checking error and
flow control.

FUNCTIONS OF TRANSPORT LAYER:

1. Service Point Addressing : Transport Layer header includes service point address which is

port address. This layer gets the message to the correct process on the computer unlike

Network Layer, which gets each packet to the correct computer.

2. Segmentation and Reassembling : A message is divided into segments; each segment

contains sequence number, which enables this layer in reassembling the message. Message

is reassembled correctly upon arrival at the destination and replaces packets which were lost

in transmission.

3. Connection Control : It includes 2 types :

o Connectionless Transport Layer : Each segment is considered as an independent packet

and delivered to the transport layer at the destination machine.

o Connection Oriented Transport Layer : Before delivering packets, connection is made

with transport layer at the destination machine.

4. Flow Control : In this layer, flow control is performed end to end.

5. Error Control : Error Control is performed end to end in this layer to ensure that the

complete message arrives at the receiving transport layer without any error. Error

Correction is done through retransmission.


Question 2: Explain Symmetric key cryptography and asymmetric key Encryption
technique.
Answer: We can divide all the cryptography algorithms (ciphers) into two groups: symmetric
key (also called secret-key) cryptography algorithms and asymmetric (also called public-key)
cryptography algorithms.
Symmetric Key Cryptography
In symmetric-key cryptography, the same key is used by both parties. The sender uses this key
and an encryption algorithm to encrypt data; the receiver uses the same key and the
corresponding decryption algorithm to decrypt the data
In symmetric key cryptography, the same key is used by the sender (for encryption) and the
receiver (for decryption).
Asymmetric-Key Cryptography
In asymmetric or public-key cryptography, there are two keys: a private key and a public key.
The private key is kept by the receiver. The public key is announced to the public, imagine Alice
wants to send a message to Bob. Alice uses the public key to encrypt the message. When the
message is received by Bob, the private key is used to decrypt the message. The key is shared.
In public-key encryption/decryption, the public key that is used for encryption is different from
the private key that is used for decryption. The public key is available to the public;' the private
key is available only to an individual
Three Types of Keys
The reader may have noticed that we are dealing with three types of keys in cryptography: the
secret key, the public key, and the private key. The first, the secret key, is the shared key used in
symmetric-key cryptography. The second and the third are the public and private keys used in
asymmetric-key cryptography.

Comparison
Let us compare symmetric-key and asymmetric-key cryptography. Encryption can be thought of
as electronic locking; decryption as electronic unlocking. The sender puts the message in a box
and locks the box by using a key; the receiver unlocks the box with a key and takes out the
message. The difference lies in the mechanism of the locking and unlocking and the type of keys
used.
In symmetric-key cryptography, the same key locks and unlocks the box. In asymmetric-key
cryptography, one key locks the box, but another key is needed to unlock it.

Question 3: Explain presentation layer and session layer design issues.

Answer: The primary goal of this layer is to take care of the syntax and semantics of the
information exchanged between two communicating systems. Presentation layer takes care that
the data is sent in such a way that the receiver will understand the information (data) and will be
able to use the data. Languages (syntax) can be different of the two communicating systems.
Under this condition presentation layer plays a role translator.

FUNCTIONS OF PRESENTATION LAYER:

1. Translation : Before being transmitted, information in the form of characters and


numbers should be changed to bit streams. The presentation layer is responsible for
interoperability between encoding methods as different computers use different encoding
methods. It translates data between the formats the network requires and the format the
computer.

2. Encryption : It carries out encryption at the transmitter and decryption at the receiver.

3. Compression : It carries out data compression to reduce the bandwidth of the data to be
transmitted. The primary role of Data compression is to reduce the number of bits to be
0transmitted. It is important in transmitting multimedia such as audio, video, text etc.

Session Layer
Its main aim is to establish, maintain and synchronize the interaction between communicating
systems. Session layer manages and synchronize the conversation between two different
applications. Transfer of data from one destination to another session layer streams of data are
marked and are resynchronized properly, so that the ends of the messages are not cut prematurely
and data loss is avoided.

FUNCTIONS OF SESSION LAYER:

1. Dialog Control : This layer allows two systems to start communication with each other in

half-duplex or full-duplex.
2. Synchronization : This layer allows a process to add checkpoints which are considered as

synchronization points into stream of data. Example: If a system is sending a file of 800

pages, adding checkpoints after every 50 pages is recommended. This ensures that 50 page

unit is successfully received and acknowledged. This is beneficial at the time of crash as if a

crash happens at page number 110; there is no need to retransmit 1 to100 pages.

Question 4: Explain RSA algorithm.

Answer: The most common public key algorithm is RSA, named for its inventors Rivest,
Shamir, and Adleman (RSA). It uses two numbers, e and d, as the public and private keys.
Bob use the following steps to select the private and public keys:
1. Bob chooses two very large prime numbers p and q. Remember that a prime number is one
that can be divided evenly only by 1 and itself.
2. Bob multiplies the above two primes to find n, the modulus for encryption and decryption. In
other words, n = p X q.
3. Bob calculates another number Ф=(p -1) X (q - 1).
4. Bob chooses a random integer e. He then calculates d so that d x e= 1 mod Ф.
5. Bob announces e and n to the public; he keeps Ф and d secret.
In RSA, e and n are announced to the public; d and Ф are kept secret.
Encryption
Anyone who needs to send a message to Bob can use n and e. For example, if Alice needs to
send a message to Bob, she can change the message, usually a short one, to an integer. This is the
plaintext. She then calculates the ciphertext, using e and n.
C=p^e(mod n)
Alice sends C, the ciphertext, to Bob.

Decryption
Bob keeps Ф and d private. When he receives the ciphertext, he uses his private key d to decrypt
the message:
P= C ^d(mod n)
Example
Bob chooses 7 and 11 as p and q and calculates n = 7. 11 = 77. The value of Ф = (7 - 1) (11 - 1)
or 60. Now he chooses two keys, e and d. If he chooses e to be 13, then d is 37. Now imagine
Alice sends the plaintext 5 to Bob. She uses the public key 13 to encrypt 5.
Plaintext: 5
C=5^13 =26 mod 77
Cipher text: 26
Bob receives the ciphertext 26 and uses the private key 37 to decipher the cipher text:
Cipher text: 26
P = 26^37 =5 mod 77
Plaintext: 5
The plaintext 5 sent by Alice is received as plaintext 5 by Bob.

Question 5: Explain different compression techniques.

Answer: Data compression is the function of presentation layer in OSI reference model.
Compression is often used to maximize the use of bandwidth across a network or to optimize
disk space when saving data . Data compression is about storing and sending a smaller number
of bits.

There are two general types of compression algorithms:

1. Lossless compression
2. Lossy compression

Lossless Compression Methods:

In lossless methods, original data and the data after compression and decompression are
exactly the same.

Redundant data is removed in compression and added during decompression.

Lossless methods are used when we can’t afford to lose any data: legal and medical documents,
computer programs
Lossless Compression Algorithms
The various algorithms used to implement lossless data compression are :

1. Run length encoding


2. Differential pulse code modulation
3. Dictionary based encoding
1. Run length encoding
• This method replaces the consecutive occurrences of a given symbol with only one copy of the
symbol along with a count of how many times that symbol occurs. Hence the names ‘run length'.
• For example, the string AAABBCDDDD would be encoded as 3A2BIC4D.
• A real life example where run-length encoding is quite effective is the fax machine. Most faxes
are white sheets with the occasional black text. So, a run-length encoding scheme can take each
line and transmit a code for while then the number of pixels, then the code for black and the
number of pixels and so on.
• This method of compression must be used carefully. If there is not a lot of repetition in the data
then it is possible the run length encoding scheme would actually increase the size of a file.
2. Differential pulse code modulation
• In this method first a reference symbol is placed. Then for each symbol in the data, we place
the difference between that symbol and the reference symbol used.
• For example, using symbol A as reference symbol, the string AAABBC DDDD would be
encoded as AOOOl123333, since A is the same as reference symbol, B has a difference of 1
from the reference symbol and so on.
3. Dictionary based encoding
• One of the best known dictionary based encoding algorithms is Lempel-Ziv (LZ) compression
algorithm.
• This method is also known as substitution coder.
• In this method, a dictionary (table) of variable length strings (common phrases) is built.
• This dictionary contains almost every string that is expected to occur in data.
• When any of these strings occur in the data, then they are replaced with the corresponding
index to the dictionary.
• In this method, instead of working with individual characters in text data, we treat each word as
a string and output the index in the dictionary for that word.
• For example, let us say that the word "compression" has the index 4978 in one particular
dictionary; it is the 4978th word is usr/share/dict/words. To compress a body of text, each time
the string "compression" appears, it would be replaced by 4978.
Lossy Compression Methods:
Used for compressing images and video files (our eyes cannot distinguish subtle changes,
so lossy data is acceptable).
These methods are cheaper, less time and space.
Several methods:
JPEG: compress pictures and graphics
MPEG: compress video
MP3: compress audio

JPEG Encoding

Used to compress pictures and graphics.

In JPEG, a grayscale picture is divided into 8x8 pixel blocks to decrease the number of
calculations.

Basic idea:

Change the picture into a linear (vector) sets of numbers that reveals the
redundancies.

The redundancies is then removed by one of lossless

MPEG Encoding

Used to compress video.

Basic idea:
Each video is a rapid sequence of a set of frames. Each frame is a spatial
combination of pixels, or a picture.

Compressing video =

Spatially compressing each frame

temporally compressing a set of frames.

Spatial Compression

Each frame is spatially compressed by JPEG.

• Temporal Compression

Redundant frames are removed.

For example, in a static scene in which someone is talking, most frames


are the same except for the segment around the speaker’s lips, which
changes from one frame to the next.

Audio Compression

Used for speech or music

Speech: compress a 64 kHz digitized signal

Music: compress a 1.411 MHz signal

• Two categories of techniques:

Predictive encoding
Perceptual encoding

Audio Encoding
Predictive Encoding

Only the differences between samples are encoded, not the whole sample
values.

Several standards: GSM (13 kbps), G.729 (8 kbps), and G.723.3 (6.4 or
5.3 kbps)

• Perceptual Encoding: MP3

CD-quality audio needs at least 1.411 Mbps and cannot be sent over the
Internet without compression.

MP3 (MPEG audio layer 3) uses perceptual encoding technique to


compress audio.

Question: Describe TCP connection management technique.


Answer: TCP is connection-oriented. A connection-oriented transport protocol establishes a
virtual path between the source and destination. All the segments belonging to a message are
then sent over this virtual path.
TCP operates at a higher level. TCP uses the services of IP to deliver individual segments to the
receiver, but it controls the connection itself. If a segment is lost or corrupted, it is retransmitted.
In TCP, connection-oriented transmission requires three phases: connection establishment, data
transfer, and connection termination.
Connection Establishment
TCP transmits data in full-duplex mode. When two TCPs in two machines are connected, they
are able to send segments to each other simultaneously.
Each party must initialize communication and get approval from the other party before any data
are transferred.
Three-Way Handshaking:
The connection establishment in TCP is called three way handshaking. In our example, an
application program, called the client, wants to make a connection with another application
program, called the server.
The process starts with the server. The server program tells its TCP that it is ready to accept a
connection. This is called a request for a passive open.
The server TCP is ready to accept any connection from any machine in the world; it cannot make
the connection itself.
The client program issues a request for an active open. A client that wishes to connect to an open
server tells its TCP that it needs to be connected to that particular server.
TCP can now start the three-way handshaking process as:

Connection establishment:
The three steps in this phase are as follows.

• The client sends the first segment, a SYN segment, in which only the SYN flag is set.
This segment is for synchronization of sequence numbers. It consumes one sequence
number.When the data transfer starts, the sequence number is incremented by 1.
• A SYN segment cannot carry data, but it consumes one sequence number.
• The server sends the second segment, a SYN +ACK segment, with 2 flag bits set: SYN
and ACK. This segment has a dual purpose.
• A SYN +ACK segment cannot carry data, but does consume one sequence number.

• The client sends the third segment. This is just an ACK segment. It acknowledges the
receipt of the second segment with the ACK flag and acknowledgment number field.
• An ACK segment, if carrying no data, consumes no sequence number.

Data Transfer
After connection is established, bidirectional data transfer can take place. The client and server
can both send data and acknowledgments.
Data traveling in the same direction as an acknowledgment are carried on the same segment. The
acknowledgment is piggybacked with the data.
Connection Termination
• Any of the two parties involved in exchanging data (client or server) can close the
connection, although it is usually initiated by the client.
• In a normal situation, the client TCP, after receiving a close command from the client
process, sends the first segment, a FIN segment in which the FIN flag is set. a FIN
segment can include the last chunk of data sent by the client, or it can be just a control
segment
• If it is only a control segment, it consumes only one sequence number.
• The server TCP, after receiving the FIN segment, informs its process of the situation and
sends the second segment, a FIN +ACK segment, to confirm the receipt of the FIN
segment from the client and at the same time to announce the closing of the connection in
the other direction. This segment can also contain the last chunk of data from the server.
If it does not carry data, it consumes only one sequence number.
• The client TCP sends the last segment, an ACK segment, to confirm the receipt of the
FIN segment from the TCP server. This segment contains the acknowledgment number,
which is 1 plus the sequence number received in the FIN segment from the server. This
segment cannot carry data and consumes no sequence numbers.

UDP (user datagram protocol)

You might also like