0% found this document useful (0 votes)
770 views67 pages

CNS Lab Manual

The document describes setting up a wired LAN using a layer 2 switch. It discusses: 1. Preparing cables and testing them with a line tester. 2. Configuring machines on the LAN with IP addresses. 3. Testing connectivity using the ping utility and capturing ping packets with Wireshark to demonstrate communication. It also provides background information on different network types, topologies, and cable types like UTP, STP, and fiber optic cables that are commonly used to set up both wired and wireless LANs.

Uploaded by

Vaibhav Dike
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)
770 views67 pages

CNS Lab Manual

The document describes setting up a wired LAN using a layer 2 switch. It discusses: 1. Preparing cables and testing them with a line tester. 2. Configuring machines on the LAN with IP addresses. 3. Testing connectivity using the ping utility and capturing ping packets with Wireshark to demonstrate communication. It also provides background information on different network types, topologies, and cable types like UTP, STP, and fiber optic cables that are commonly used to set up both wired and wireless LANs.

Uploaded by

Vaibhav Dike
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/ 67

Dr. D. Y.

Patil Pratishthan’s

DR. D. Y. PATIL INSTITUTE OF ENGINEERING, MANAGEMENT &


RESEARCH

Approved by A.I.C.T.E, New Delhi , Maharashtra State Government, Affiliated to Savitribai Phule Pune University
Sector No. 29, PCNTDA , Nigidi Pradhikaran, Akurdi, Pune 411044. Phone: 020–27654470, Fax: 020-27656566
Website : www.dypiemr.ac.in Email : [email protected]
_____________________________________________________________________________________________

Department of Computer Engineering


LAB MANUAL

Computer Networks and Security


(Third Year Computer Engineering)
Semester I

Prepared By:
Mrs. Nalini Jagtap
Mrs. Chaitali Shewale

Computer Network DYPIEMR


Computer Networks and Security
Course Code Course Name Teaching Scheme (Hrs. / Week) Credits
310247 Computer Networks and Security Lab 2 1

Course Objectives:

 To learn computer network hardware and software components


 To learn computer network topologies and types of network
 To develop an understanding of various protocols, modern technologies and applications
 To learn modern tools for network traffic analysis
 To learn network programming

Course Outcomes:
CO1: Analyze the requirements of network types, topology and transmission media
CO2: Demonstrate error control, flow control techniques and protocols and analyze them
CO3: Demonstrate the subnet formation with IP allocation mechanism and apply various routing
algorithms
CO4: Develop Client-Server architectures and prototypes
CO5: Implement web applications and services using application layer protocols
CO6: Use network security services and mechanisms

The instructor is expected to frame the assignments by understanding the prerequisites, technological aspects,
utility and recent trends related to the topic. The assignment framing policy need to address the average students
and inclusive of an element to attract and promote the intelligent students. Use of open source software is
encouraged. Based on the concepts learned. Instructor may also set one assignment or mini-project that is suitable
to respective branch beyond the scope of syllabus.

Operating System recommended: -64-bit Open-source Linux or its derivative Programming tools recommended: -
Open-Source/C/C++/JAVA Programming tool like G++/GCC, Wireshark/Ethereal and Packet Tracer

2
Table of Contents
Sr. No Title of experiment CO Page no
Mapping
1. Setup a wired LAN using Layer 2 Switch. It includes preparation CO1 1
of cable, testing of cable using line tester, configuration machine
using IP addresses, testing using PING utility and demonstrating
the PING packets captured traces using Wireshark Packet
Analyzer Tool.
2. Setup a WAN which contains wired as well as wireless LAN by using CO1 11
a packet tracer tool. Demonstrate transfer of a packet from LAN 1
3. (wireda LAN)
Write programto LAN2 (Wireless
for error LAN).
detection and correction for 7/8 bits ASCII CO2 17
codes using Hamming Codes or CRC.
4. Write a program to simulate Go back N and Selective Repeat Modes CO2 25
of Sliding Window Protocol in Peer- to-Peer mode.
5. Write a program to demonstrate Sub-netting and find subnet masks CO3 35
6. Use packet Tracer tool for configuration of 3 router network using CO3 39
one of the following protocol RIP/OSPF/BGP.

7 Write a program using TCP. socket for wired network for following CO4 45
a. Say Hello to Each other b. File transfer c. Calculator

8 Write a program using UDP Sockets to enable file transfer (Script, CO4 51
Text, Audio and Video one file each) between two machines.
9 Write the exact packet capture filter expressions to accomplish the CO5 54
following and save the output in file:

1. Capture all TCP traffic to/from Facebook, during the time when you
log in to your Facebook account

2. Capture all HTTP traffic to/from Facebook, when you log in to your
Facebook account

3. Write a DISPLAY filter expression to count all TCP packets


(captured under item #1) that have the flags SYN, PSH, and RST set.
Show the fraction of packets that had each flag set.

4. Count how many TCP packets you received from / sent to Face
book, and how many of each were also HTTP packet

10 Write a program for DNS lookup. Given an IP address as input, it CO5 57


should return URL and vice-versa
11 Study and Analyze the performance of HTTP, HTTPS and FTP CO5 62
protocol using Packet tracer tool.

3
12 To study the SSL protocol by capturing the packets using Wireshark CO6 69
tool while visiting any SSL secured website (banking, e- commerce
etc.).

Lab Assignment 1

4
Title : Setup a Wired/Wireless LAN

PROBLEM STATEMENT:

Setup a wired LAN using Layer 2 Switch. It includes preparation of cable, testing of cable using line tester,
configuration machine using IP addresses, testing using PING utility and demonstrating the PING packets captured
traces using Wireshark Packet Analyzer Tool.

THEORY:
1. TYPES OF NETWORK
Common examples of area network types are:

LAN - Local Area Network

WLAN - Wireless Local Area Network

WAN - Wide Area Network

MAN - Metropolitan Area Network

PAN - Personal Area Network

LAN - Local Area Network

A LAN connects network devices over a relatively short distance. A networked office building, school, or home usually
contains a single LAN, though sometimes one building will contain a few small LANs (perhaps one per room), and
occasionally a LAN will span a group of nearby buildings.

MAN-Metropolitan Area Network

A network spanning a physical area larger than a LAN but smaller than a WAN, such as a city. A MAN is typically
owned and operated by a single entity such as a government body or large corporation.

WAN - Wide Area Network

As the term implies, a WAN spans a large physical distance. The Internet is the largest WAN, spanning the Earth. A WAN
is a geographically-dispersed collection of LANs. A network device called a router connects LANs to a WAN. In IP
networking, the router maintains both a LAN address and a WAN address.

2. TYPES OF CABLES
Cable is the medium through which information usually moves from one network device to another. There are several
types of cable which are commonly used with LANs. In some cases, a network will utilize only one type of cable, other
networks will use a variety of cable types. The type of cable chosen for a network is related to the network's topology,
protocol, and size. Understanding the characteristics of different types of cable and how they relate to other aspects of a
network is necessary for the development of a successful network.

The following sections discuss the types of cables used in networks and other related topics.

Unshielded Twisted Pair (UTP) Cable

Shielded Twisted Pair (STP) Cable

5
Coaxial Cable

Fiber Optic Cable

Cable Installation Guides

Wireless LANs

Unshielded Twisted Pair (UTP) Cable

Twisted pair cabling comes in two varieties: shielded and unshielded. Unshielded twisted pair (UTP) is the most popular
and is generally the best option for school networks

The quality of UTP may vary from telephone-grade wire to extremely high-speed cable. The cable has four pairs of wires
inside the jacket. Each pair is twisted with a different number of twists per inch to help eliminate interference from
adjacent pairs and other electrical devices. The tighter the twisting, the higher the supported transmission rate and the
greater the cost per foot. The EIA/TIA (Electronic Industry

Unshielded Twisted Pair Connector

The standard connector for unshielded twisted pair cabling is an RJ-45 connector. This is a plastic connector that looks
like a large telephone-style connector (See fig. 2). A slot allows the RJ-45 to be inserted only one way. RJ stands for
Registered Jack, implying that the connector follows a standard borrowed from the telephone industry. This standard
designates which wire goes with each pin inside the connector.

Shielded Twisted Pair (STP) Cable

Although UTP cable is the least expensive cable, it may be susceptible to radio and electrical frequency interference (it
should not be too close to electric motors, fluorescent lights, etc.). If you must place cable in environments with lots of
potential interference, or if you must place cable in extremely sensitive environments that may be susceptible to the
electrical current in the UTP, shielded twisted pair may be the solution. Shielded cables can also help to extend the
maximum distance of the cables.

Shielded twisted pair cable is available in three different configurations:

1. Each pair of wires is individually shielded with foil.

2. There is a foil or braid shield inside the jacket covering all wires (as a group).

3. There is a shield around each individual pair, as well as around the entire group of

wires (referred to as double shield twisted pair).

Coaxial Cable

Coaxial cabling has a single copper conductor at its center. A plastic layer provides insulation between the center
conductor and a braided metal shield.

Although coaxial cabling is difficult to install, it is highly resistant to signal interference. In addition, it can support greater
cable lengths between network devices than twisted pair cable. The two types of coaxial Thin coaxial cable is also referred
to as thinnet. 10Base2 refers to the specifications for thin coaxial cable carrying Ethernet signals. The 2 refers to the
approximate maximum segment length being 200 meters. In actual fact the maximum segment length is 185 meters. Thin
coaxial cable has been popular in Thick coaxial cable is also referred to as thicknet. 10Base5 refers to the specifications
for thick coaxial cable carrying Ethernet signals.

6
Coaxial Cable Connectors

The most common type of connector used with coaxial cables is the Bayone-Neill-Concelman (BNC) connector.
Different types of adapters are available for BNC connectors, including a T-connector, barrel connector, and terminator.
Connectors on the cable are the weakest points in any network. To help avoid problems with your network, always use
the BNC connectors that crimp, rather

Fiber Optic Cable

Fiber optic cabling consists of a center glass core surrounded by several layers of protective materials. It transmits light
rather than electronic signals eliminating the problem of electrical interference. This makes it ideal for certain
environments that contain a large amount of electrical interference. It has also made it the standard for connecting
networks between Fiber optic cable has the ability to transmit signals over much longer distances than coaxial and twisted
pair. It also has the capability to carry information at vastly greater speeds. This capacity broadens communication
possibilities to include services such as video conferencing and interactive services. The cost of fiber optic cabling is
comparable to copper cabling; however, it is The center core of fiber cables is made from glass or plastic fibers.

There are two common types of fiber cables -- single mode and multimode.

3. NETWORK DEVICES
Computer networking devices are units that mediate data in a computer network. A list of computer networking devices
follows:

1. Gateway
A device sitting at a network node for interfacing with another network that uses different protocols.

Router

A router is a computer networking device that forwards data packets across a network toward their destinations, through
a process known as routing. Routing occurs at layer 3 (the Network layer e.g. IP) of the OSI seven-layer protocol stack.

Bridge

A network bridge connects multiple network segments at the data link layer. It is sometimes called a network switch, and
it works by using bridging.

Switch

A switch is a device that allocates traffic from one network segment to certain lines which connect the segment to another
network segment. So unlike a hub a switch splits the network traffic and sends it to different destinations rather than to
all systems on the network.

Layer 2 Switch

Traditional switching operates at layer 2 of the OSI model, where packets are sent to a specific switch port based on
destination MAC addresses.

Layer 3 Switch

Routing operates at layer 3, where packets are sent to a specific next-hop IP address, based on destination IP address.

Hub

7
An Ethernet hub or concentrator connects multiple Ethernet segments together making them act as a single segment.
When using a hub, every attached device shares the same broadcast domain and the same collision domain.

Repeater

A repeater is an electronic device that receives a weak or low-level signal and retransmits it at a higher level or higher
power, so that the signal can cover longer distances without degradation.

4. PING UTILITY
Ping Command: The ping command is a Command Prompt command used to test the ability of the source computer to
reach a specified destination computer. The ping command is usually used as a simple way verify that a computer can
communicate over the network with another computer or network device. The ping command operates by sending Internet
Control Message Protocol (ICMP) Echo Request messages to the destination computer and waiting for a response. How
many of those responses are returned, and how long it takes for them to return, are the two major pieces of information
that the ping command provides.

Syntax :

ping ip address e.g. ping 192.168.7.2

5. WIRELESS NETWORK USING ACCESS POINT


In computer networking, a wireless access point (WAP), or more generally just access point (AP), is
a networking hardware device that allows a Wi-Fi device to connect to a wired network. The AP usually
connects to a router (via a wired network) as a standalone device, but it can also be an integral component of
the router itself. An AP is differentiated from a hotspot, which is the physical location where Wi-Fi access to
a WLAN is available.

A wireless AP connects a group of wireless stations to an adjacent wired LAN. Conceptually, an AP is like an
Ethernet hub, but instead of relaying LAN frames only to other 802.3 stations, an AP relays 802.11 frames to
all other 802.11 or 802.3 stations in the same subnet.

6. WIRESHARK TOOL
Wireshark is a network packet analyzer. A network packet analyzer will try to capture network packets and tries
to display that packet data as detailed as possible.

8
A network packet analyzer as a measuring device used to examine what’s going on inside a network cable, just
like a voltmeter is used by an electrician to examine what’s going on inside an electric cable (but at a higher
level, of course).

Purpose
● Network administrators use it to troubleshoot network problems
● Network security engineers use it to examine security problems
● Developers use it to debug protocol implementations
● People use it to learn network protocol internals

Features
● Capture live packet data from a network interface.
● Open files containing packet data captured with tcpdump/WinDump, Wireshark, and a number of other
packet capture programs.
● Import packets from text files containing hex dumps of packet data.
● Display packets with very detailed protocol information.
● Save packet data captured.
● Export some or all packets in a number of capture file formats.
● Filter packets on many criteria.
● Search for packets on many criteria.
● Colorize packet display based on filters.
● Create various statistics.
Procedure

Setting up a local network and file sharing,

Use the steps in this section to set up a home network using standard RJ-45 hardware and cables.

Confirm that you have the following hardware and follow these steps:
● Network interface card (NIC) or an on-the-motherboard network port for each computer. HP and
Compaq computers are network ready with NICs installed. Confirm the computer has a RJ-45 network
port on the back.
Figure : Shape of RJ-45 connector

● Disconnect the Internet. If you have a DSL or cable modem, disconnect it.
● Disable any firewall software. Firewall software may interfere with network setup. You can enable the
firewall after network setup is complete.
9
Step 1: Connecting the network hardware and cables to set up a local network

Do the following to set up the network hardware and connect the networking cables.

1. Set up and turn on the power for the switch or other networking device.
2. Connect the computers to the networking device. If a crossover cable is used, connect the cable to the
RJ45 network ports on each computer.
Figure : Example of one possible setup configuration

3. Connect the computer power cords and turn the computers on.
Step 2: Turning on Network discovery and file sharing in Windows 7
Turn on Network discovery and file sharing on each computer that you want to access on the network. Follow
these steps to begin setting up the network:

1. Click Start, and then click Control Panel.


2. Under Network and Internet, click Choose Homegroup and sharing options.
3. In the Homegroup settings window, click Change advanced sharing settings.
4. Turn on network discovery and file and printer sharing. Review the other settings and turn them on or
off.
5. Click Save changes.

Step 3: Sharing drives, folders, and files in a network

CONCLUSION: Thus we have Setup a wired LAN and performed ping operation.

10
Lab Assignment 2

TITLE
Setup a WAN which contains wired as well as wireless LAN

PROBLEM STATEMENT

Setup a WAN which contains wired as well as wireless LAN by using a packet tracer tool. Demonstrate
transfer of a packet from LAN 1 (wired LAN) to LAN2 (Wireless LAN).

THEORY
From year to year, Cisco has updated many versions with difference questions. The latest version is version 6.0
in 2018. What is your version? It depends on your instructor creating your class. We recommend you to go
thought all version if you are not clear. While you take online test with netacad.com, You may get random
questions from all version. Each version have 1 to 10 different questions or more. After you review all questions,
You should practice with our online test system by go to "Online Test" link below.

Packet Tracer

Connecting a Wired and Wireless LAN

Red font color or gray highlights indicate text that appears in the Answer copy only.

When working in Packet Tracer (a lab environment or a corporate setting), you should know how to select the
appropriate cable and how to properly connect devices. This activity will examine device configurations in

11
Packet Tracer, selecting the proper cable based on the configuration, and connecting the devices. This activity
will also explore the physical view of the network in Packet Tracer.

There are many methods of deploying wide area network (WAN) when using Cisco routers. Some of these
methods are HDLC, PPP, Frame Relay, and MPLS. The Point to point protocol is an industry standard WAN
protocol that allows for the deployment of secured wide area connections between routers from different
vendors. In this post, I will share with us on how to successfully configure PPP with authentication between
two Cisco routers stationed miles apart from each other.

IMPLEMENTATION:
ROUTER A

Router#conf t

Router(config)#host RouterA

RouterA(config)#int s0/3/0

RouterA(config-if)#clock rate 64000

RouterA(config-if)#ip add 192.168.1.1 255.255.255.252

RouterA(config-if)#no shut

RouterA(config-if)#encapsulation ppp

RouterA(config-if)#ppp authentication chap

RouterA(config-if)#username RouterB pass cisco

RouterA(config)#

Router B

Router>en

Router#conf t

Router(config)#host RouterB

RouterB(config)#int s0/3/0

RouterB(config-if)#ip add 192.168.1.2 255.255.255.252

RouterB(config-if)#no shut

RouterB(config-if)#encapsulation ppp

RouterB(config-if)#ppp authentication chap

12
RouterB(config-if)#username RouterA pass cisco

RouterB(config)#

CONCLUSION
Packet Tracer tool is used for configuration WLAN

OUTPUT/SCREENSHOT

13
Lab Assignment 3

Title: Hamming Code/ CRC code


PROBLEM STATEMENT:

Write a program for error detection and correction for 7/8 bits ASCII codes using Hamming Codes or CRC.

THEORY:
Hamming Code

1. Hamming codes can detect up to two-bit errors or correct one-bit errors without detection of uncorrected
errors. By contrast, the simple parity code cannot correct errors, and can detect only an odd number of
bits in error. ... In this context, an extended Hamming code having one extra parity bit is often used.
2. In Hamming codes the bits of the codeword are numbered consecutively, starting with bit 1 at the left
end, bit 2 to its immediate right, and so on. The bits that are powers of 2 (1, 2, 4, 8, 16, etc.) are check
bits. The rest (3, 5, 6, 7, 9, etc.) are filled up with the m data bits. This pattern is shown for an (11,7)
Hamming code with 7 data bits and 4 check .

Basic approach for error detection by using Hamming code is as follows:

• To each group of m information bits k parity bits are added to form (m+k) bit code.

• Location of each of the (m+k) digits is assigned a decimal value.

• The k parity bits are placed in positions 1, 2, …, 2k-1 positions.–K parity checks are performed on selected
digits of each codeword.

• At the receiving end the parity bits are recalculated. The decimal value of the k parity bits provides the bit-
position in error, if any.

14
Cyclic Redundancy Checks (CRC)

This Cyclic Redundancy Check is the most powerful and easy to implement technique. Unlike checksum
scheme, which is based on addition, CRC is based on binary division. In CRC, a sequence of redundant bits,
called cyclic redundancy check bits, are appended to the end of data unit so that the resulting data unit becomes
exactly divisible by a second, predetermined binary number. At the destination, the incoming data unit is
divided by the same number. If at this step there is no remainder, the data unit is assumed to be correct and is
therefore accepted. A remainder indicates that the data unit has been damaged in transit and therefore must be
rejected. The generalized technique can be explained as follows.

If a k bit message is to be transmitted, the transmitter generates an r-bit sequence, known as Frame Check
Sequence (FCS) so that the (k+r) bits are actually being transmitted. Now this r-bit FCS is generated by dividing
the original number, appended by r zeros, by a predetermined number. This number, which is (r+1) bit in length,
can also be considered as the coefficients of a polynomial, called Generator Polynomial. The remainder of this
division process generates the r-bit FCS. On receiving the packet, the receiver divides the (k+r) bit frame by
the same predetermined number and if it produces no remainder, it can be assumed that no error has occurred
during the transmission. Operations at both the sender and receiver end are shown in Fig.

15
This mathematical operation performed is illustrated in Figure. by dividing a sample 4bit number by the
coefficient of the generator polynomial x3+x+1, which is 1011, using the modulo-2 arithmetic. Modulo-2
arithmetic is a binary addition process without any carry over, which is just the Exclusive-OR operation.
Consider the case where k=1101. Hence we have to divide 1101000 (i.e. k appended by 3 zeros) by 1011,
which produces the remainder r=001, so that the bit frame (k+r) =1101001 is actually being transmitted through
the communication channel. At the receiving end, if the received number, i.e., 1101001 is divided by the same
generator polynomial 1011 to get the remainder as 000, it can be assumed that the data is free of errors.

The transmitter can generate the CRC by using a feedback shift register circuit. The same circuit can also be
used at the receiving end to check whether any error has occurred. All the values can be expressed as
polynomials of a dummy variable X.

CONCLUSION: Hamming code and CRC code executed successfully.

16
/* CRC Code*/
#include <stdio.h>
#include <string.h>
int main() {
int i,j,keylen,msglen,flag=0;
char input[100], key[30],temp[30],quot[100],rem[30],key1[30];

printf("Enter Data: ");


scanf("%s",input);
printf("Enter Key: ");
scanf("%s",key);
keylen=strlen(key);
msglen=strlen(input);
strcpy(key1,key);
for (i=0;i<keylen-1;i++) {
input[msglen+i]='0';
}
for (i=0;i<keylen;i++)
temp[i]=input[i];
for (i=0;i<msglen;i++) {
quot[i]=temp[0];
if(quot[i]=='0')
for (j=0;j<keylen;j++)
key[j]='0'; else
for (j=0;j<keylen;j++)
key[j]=key1[j];
for (j=keylen-1;j>0;j--) {
if(temp[j]==key[j])
rem[j-1]='0'; else
rem[j-1]='1';
}
rem[keylen-1]=input[i+keylen];
strcpy(temp,rem);
}
strcpy(rem,temp);
printf("\nQuotient is ");
for (i=0;i<msglen;i++)
printf("%c",quot[i]);
printf("\nRemainder is ");
for (i=0;i<keylen-1;i++)
printf("%c",rem[i]);
flag=0;
for (i=0;i<keylen-1;i++)
{
if(rem[i] == 0)
flag=0;
}
if(flag==0)
printf("\nNo Error");
else
printf("\nError is detected");

printf("\nFinal data is: ");


for (i=0;i<msglen;i++)
printf("%c",input[i]);

17
for (i=0;i<keylen-1;i++)
printf("%c",rem[i]);

printf("\n");
char temp1[20];
printf("Enter recieved data\t");
scanf("%s",temp1);

for (i=0;i<keylen;i++)
temp[i]=temp1[i];
for (i=0;i<msglen;i++) {
quot[i]=temp[0];
if(quot[i]=='0')
for (j=0;j<keylen;j++)
key[j]='0'; else
for (j=0;j<keylen;j++)
key[j]=key1[j];
for (j=keylen-1;j>0;j--) {
if(temp[j]==key[j])
rem[j-1]='0'; else
rem[j-1]='1';
}

rem[keylen-1]=temp1[i+keylen];
strcpy(temp,rem);
}
strcpy(rem,temp);
printf("\nQuotient is ");
for (i=0;i<msglen;i++)
printf("%c",quot[i]);
printf("\nRemainder is ");
for (i=0;i<keylen-1;i++)
printf("%c",rem[i]);

flag=0;
for (i=0;i<keylen-1;i++)
{
if(rem[i]=='1')
flag=1;

else
flag=0;
}
if(flag==0)
printf("\nNo Error");
else
printf("\nError is detected");

return 0;

18
/* Hamming Code*/

#include<stdio.h>

int main()
{
int data[10];
int rec[10];
printf("Enter 4 bits one by one:-\n");
scanf("%d",&data[3]);
scanf("%d",&data[5]);
scanf("%d",&data[6]);
scanf("%d",&data[7]);

data[1]=data[3]^data[5]^data[7];
data[2]=data[3]^data[6]^data[7];
data[4]=data[5]^data[6]^data[7];
printf("\nEncoded data is\n");
for(int i=1;i<=7;i++)
printf("%d",data[i]);

printf("\n\nEnter received data bits one by one\n");


for(int i=1;i<=7;i++)
scanf("%d",&rec[i]);

printf("\nSent Data:-\n");
for(int i=1;i<=7;i++)
printf("%d",data[i]);

printf("\nReceived Data:-\n");
for(int i=1;i<=7;i++)
printf("%d",rec[i]);

int c,c1,c2,c3;
c1=rec[1]^rec[3]^rec[5]^rec[7];
c2=rec[2]^rec[3]^rec[6]^rec[7];
c3=rec[4]^rec[5]^rec[6]^rec[7];
c=4*c3+2*c2+c1;
if(c==0)
{
printf("\nNo error while transmission of data\n");
}
else
{
if(rec[c]==0)
rec[c]=1;
else
rec[c]=0;
printf("\nCorrected Data:-\n");
for(int i=1;i<=7;i++)
printf("%d",rec[i]);
}
return 0;
}

19
Experiment Number: 04
Title: Program to implement sliding window protocol

PROBLEM STATEMENT

Write a program to simulate Go back N and Selective Repeat Modes of Sliding Window Protocol in Peer- to-Peer mode

Theory:

SLIDING WINDOW PROTOCOL

Sliding Window Protocols assumes two-way communication (full duplex). It uses two types of frames: 1. Data 2. Ack
(sequence number of last correctly received frame)

The basic idea of sliding window protocol is that both sender and receiver keep a ``window'' of acknowledgment. The
sender keeps the value of expected acknowledgment; while the receiver keeps the value of expected receiving frame.
When it receives an acknowledgment from the receiver, the sender advances the window. When it receives the expected
frame, the receiver advances the window.

In transmit flow control, sliding window is a variable-duration window that allows a sender to transmit a specified number
of data units before an acknowledgement is received or before a specified event occurs.

An example of a sliding window in packet transmission is one in which, after the sender fails to receive an
acknowledgement for the first transmitted packet, the sender "slides" the window, i.e. resets the window, and sends a
second packet. This process is repeated for the specified number of times before the sender interrupts transmission. Sliding
window is sometimes (loosely) called acknowledgement delay period.

For example, supposing a fixed window size of m packets, a sender may send out packets before receiving any
acknowledgement. If acknowledgement arrives from the receiver for packet n, then the range (window) of
unacknowledged packets slides to , and the sender is able to send out packet (n + m). In some way, "sliding" signifies a
FIFO operation, trimming the range at one end, extending it at the other end.

The purpose of the sliding window is to increase throughput. Let's denote the round trip time with RTT. The time necessary
to transfer and acknowledge K (a big number of) packets is roughly (in one round trip, 2m packets and 2m ACKs are
delivered). However, the size of the window (in bytes) should not grow above "capacity of the path" (the sum of affected
network buffer sizes of all hops along the path): windows that are too big do not increase throughput; they only increase
latency, the number of packets transmitted out-of-order, and memory usage.

Go-Back N ARQ Protocol


The most popular ARQ protocol is the go-back-N ARQ, where the sender sends the frames continuously without waiting
for acknowledgement. That is why it is also called as continuous ARQ. As the receiver receives the frames, it keeps on
sending ACKs or a NACK, in case a frame is incorrectly received. When the sender receives a NACK, it retransmits the
frame in error plus all the succeeding frames.

20
In practice, protocols often adapt the window size to the link's speed and actual saturation or congestion.

21
Selective Repeat ARQ
Selective Repeat ARQ is a specific instance of the Automatic Repeat-reQuest (ARQ) Protocol, in which the sending
process continues to send a number of frames specified by a window size even after a frame loss. Unlike Go-Back-N
ARQ, the receiving process will continue to accept and acknowledge frames sent after an initial error.

The selective-repetitive ARQ scheme retransmits only those for which NAKs are received or for which timer has expired,
this is shown in the Figure. This is the most efficient among the ARQ schemes, but the sender must be more complex so
that it can send out-of-order frames. The receiver also must have storage space to store the post NAK frames and
processing power to reinsert frames in proper sequence.

The receiver process keeps track of the sequence number of the earliest frame it has not received, and sends that number
with every ACK it sends. If a frame from the sender does not reach the receiver, the sender continues to send subsequent
frames until it has emptied its window. The receiver continues to fill its receiving window with the subsequent frames,
replying each time with an ACK containing the sequence number of the earliest missing frame. Once the sender has sent
all the frames in its window, it resends the frame number given by the ACKs, and then continues where it left off.

22
The size of the sending and receiving windows must be equal, and half the maximum sequence number (assuming that
sequence numbers are numbered from 0 to n-1) to avoid miscommunication in all cases of packets being dropped. The
sender moves its window for every packet that is acknowledged.

23
Conclusion:

Implemented Go Back N and Selective Repeat Sliding Window protocol.The sliding window implements reliability at
both the data-link layer and the transport layer of the network protocol stack, like TCP/IP.

24
/* Selective Repeat - Client Side*/
import java.lang.System;
import java.net.*;
import java.io.*;

public class Client {


static Socket connection;

public static void main(String a[]) throws SocketException {


try {
int v[] = new int[8];
//int g[] = new int[8];
int n = 0;
InetAddress addr = InetAddress.getByName("Localhost");
System.out.println(addr);
connection = new Socket(addr, 8011);
DataOutputStream out = new DataOutputStream(
connection.getOutputStream());
DataInputStream in = new DataInputStream(
connection.getInputStream());
int p = in.read();
System.out.println("No of frame is:" + p);

for (int i = 0; i < p; i++) {


v[i] = in.read();
System.out.println(v[i]);
//g[i] = v[i];
}
v[5] = -1;
for (int i = 0; i < p; i++)
{
System.out.println("Received frame is: " + v[i]);

}
for (int i = 0; i < p; i++)
if (v[i] == -1) {
System.out.println("Request to retransmit from packet no "
+ (i+1) + " again!!");
n = i;
out.write(n);
out.flush();
}

System.out.println();

v[n] = in.read();
System.out.println("Received frame is: " + v[n]);

System.out.println("quiting");
} catch (Exception e) {
25
System.out.println(e);
}

}
}

/* Selective Repeat - Server Side*/


import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;

public class Server {


static ServerSocket Serversocket;
static DataInputStream dis;
static DataOutputStream dos;

public static void main(String[] args) throws SocketException {

try {
int a[] = { 30, 40, 50, 60, 70, 80, 90, 100 };
Serversocket = new ServerSocket(8011);
System.out.println("waiting for connection");
Socket client = Serversocket.accept();
dis = new DataInputStream(client.getInputStream());
dos = new DataOutputStream(client.getOutputStream());
System.out.println("The number of packets sent is:" + a.length);
int y = a.length;
dos.write(y);
dos.flush();

for (int i = 0; i < a.length; i++) {


dos.write(a[i]);
dos.flush();
}

int k = dis.read();

dos.write(a[k]);
dos.flush();

} catch (IOException e) {
System.out.println(e);
} finally {
try {
dis.close();
dos.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
26
}

/* Go Back N - Client Side*/


import java.io.*;
import java.net.*;
import java.math.*;
import java.util.*;

class testclient
{

public static void main(String args[])throws IOException


{
InetAddress addr=InetAddress.getByName("Localhost");
System.out.println(addr);

Socket connection=new Socket(addr,500);

BufferedInputStream in=new BufferedInputStream(connection.getInputStream());


DataOutputStream out=new DataOutputStream(connection.getOutputStream());
Scanner scr=new Scanner(System.in);// this will be used to accept i/p from
console

System.out.println(".......Client........");
System.out.println("Connect");
System.out.println("Enter the number of frames to be requested to the server");
int c=scr.nextInt();

out.write(c);
out.flush();

System.out.println("Enter the type of trans. Error=1 ; No Error=0");


int choice=scr.nextInt();
out.write(choice);

int check=0;
int i=0;
int j=0;

if(choice==0)
{
for(j=0;j<c;++j)
{
i=in.read();
System.out.println("received frame no: "+i);
System.out.println("Sending acknowledgement for frame no: "+i);
out.write(i);
out.flush();
}
out.flush();
}
else
{
for(j=0;j<c;++j)
{
27
i=in.read();
if(i==check)
{
System.out.println("received frame no: "+i);
System.out.println("Sending acknowledgement for frame no: "+i);
out.write(i);
++check;
}
else
{
--j;
System.out.println("Discarded frame no: "+i);
System.out.println("Sending NEGATIVE ack");
out.write(-1);
}
out.flush();
}
}//end of else for error

in.close();
out.close();
System.out.println("Quiting");

}// end of main method


}// end of main class

/* Go Back N - Server Side*/


import java.io.*;
import java.net.*;
import java.util.*;
class testserver
{
public static void main(String args[])throws IOException
{
System.out.println("...........Server..........");
System.out.println("Waiting for connection....");
InetAddress addr=InetAddress.getByName("Localhost");
ServerSocket ss=new ServerSocket(500);

Socket client=new Socket();


client=ss.accept();

BufferedInputStream in=new BufferedInputStream(client.getInputStream());


DataOutputStream out=new DataOutputStream(client.getOutputStream());

System.out.println("Received request for sending frames");


int p=in.read();

boolean f[]=new boolean[p];

int pc=in.read();
System.out.println("Sending....");

if(pc==0)
{
28
for(int i=0;i<p;++i)
{
System.out.println("sending frame number "+i);
out.write(i);
out.flush();
System.out.println("Waiting for acknowledgement");
try
{
Thread.sleep(7000);
}
catch(Exception e){}

int a=in.read();
System.out.println("received acknowledgement for frame "+i+" as "+a);
}
out.flush();
}
else
{
for(int i=0;i<p;++i)
{
if(i==2)
{
System.out.println("sending frame no "+i);
}
else
{
System.out.println("sending frame no "+i);
out.write(i);
out.flush();
System.out.println("Waiting for acknowledgement ");
try
{
Thread.sleep(7000);
}
catch(Exception e){}

int a=in.read();

if(a!=255)
{
System.out.println("received ack for frame no: "+i+" as "+a);
f[i]=true;
}
}// end of inner else
}// end of for

// check which frames have not been ack

for(int a=0;a<p;++a)
{
if(f[a]==false)
{
System.out.println("Resending frame "+a);
out.write(a);
out.flush();
System.out.println("Waiting for ack ");
29
try
{
Thread.sleep(5000);
}
catch(Exception e){}

int b=in.read();
System.out.println("received ack for frame no: "+a+" as "+b);
f[a]=true;
}
}
out.flush();
}// end of else which is for error

in.close();
out.close();
client.close();
ss.close();
System.out.println("Quiting");

}// end main method


}// end main class

30
Assignment no: 5

Title: Subnetting

Problem Statement:
Write a program to demonstrate Sub-netting and find subnet masks.

Objectives:
1] To learn concept of subnetting a network.

2] To study how to subnet a Class C network

Theory:
Subnetting (RFC 950) is the process of dividing any classful IP network (Class A, Class B, or

Class C network) into smaller networks.

What is Subnet Mask?

An IPv4 address has two components, the network part and the host part. IPv4 address

is a combination of IPv4 address and Subnet mask. The purpose of subnet mask is to identify which part of an
IPv4 address is the network part and which part is the host part. Subnet mask is also a 32 bit number where all
the bits of the network part are represented as "1" and all the bits of the host part are represented as "0".

If we take an example for a Class C network , 192.168.10.0, the address part and the subnet mask can be
represented as below

For a Class C IPv4 address , the first three octets are used to represent the Network part and the last octet is
used to represent the host part. From the above table, we can see all "1" in the network part and all "0" in the
host part. When this subnet mask is converted to a decimals, it will become 255.2555.255.0. The default subnet
mask for a Class C network is 255.255.255.0, Class B network is 255.255.0.0 and Class A network is 255.0.0.0.

What is a Network Address?

A network address is used to identify the subnet that a host may be placed on and is used to represent that
network. We can find the network address by assigning all bits in the host part as 0.

Class C Subnetting

Subnetting is done by taking the bit/s from host part and adding it to the network part. Consider

the same Class C example given above. Remember, the first three octets of a Class C network

31
is used to represent the network and the last octet is used to represent the host. The default format for a Class C
IPv4 address is Network.Network.Network.Host.

To make things easy, you may remember this.

If all the bits in the host part are "0", that represents the network id.

If all the bits in the host part are "0" except the last bit, it is the first usable IPv4 address.

If all the bits in the host part are "1" except the last bit, it is the last usable IPv4 address.

If all the bits in the host part are "1", that represents the directed broadcast address.

All the IPv4 addresses between the first and last IPv4 addresses(including the first and last) can

be used to configure the devices.

Class C

One Bit Subnetting

Consider the network shown above. If we include one bit from the host part to the network part,

The subnet mask is changed into 255.255.255.128. The single bit can have two values in last

octet, either 0 or 1.

11000000.10101000.00001010.0|0000000

11111111.11111111.11111111.1 | 0000000

That means, we can get two subnets if we do a single bit subnetting.

The network 192.168.10.0 is divided into two networks, each network has 128 total IPv4 addresses and 126
usableIPv4 addresses (two IPv4 addresses are used in each subnet to represent the network address and the
directed broadcast address). The subnet mask for one bit subnetting is 255.255.255.128.

Class C - Two Bit Subnetting (expected solution of problem statement)

If we include two bits from the host part to the network part, the subnet mask is changed into 255.255.255.192.
The two bits added to network part can have four possible values in last octet and that are 00, 01, 10 and 11.
That means, we can get four networks if we do a two bit subnetting (as expected in the problem statement).

11000000.10101000.00001010.00 | 000000

11111111.11111111.11111111.11 | 000000

32
The network 192.168.10.0 is divided into four networks, each network has 64 total IPv4 addresses and 62
usableIPv4 addresses (two IPv4 addresses are used in each subnet to represent the network address and the
directed broadcast address). The subnet mask for two bit subnetting is 255.255.255.192.

Class C Subnetting can be summerized as below:

Conclusion:

By this assignment we have studied subnetting of class C networks.

/* Subnet Program*/

import java.util.Scanner;
class Subnet{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter the ip address: ");
String ip = sc.nextLine();
String split_ip[] = ip.split("\\."); //SPlit the string after every .
String split_bip[] = new String[4]; //split binary ip
String bip = "";
for(int i=0;i<4;i++)
{
33
split_bip[i] =
appendZeros(Integer.toBinaryString(Integer.parseInt(split_ip[i]))); // "18" =>
18 => 10010 => 00010010
bip += split_bip[i];
}
System.out.println("IP in binary is "+bip);
System.out.print("Enter the number of addresses: ");
int n = sc.nextInt();

//Calculation of mask
int bits = (int)Math.ceil(Math.log(n)/Math.log(2)); /*eg if address = 120, log
120/log 2 gives log to the base 2 => 6.9068, ceil gives us upper integer */
System.out.println("Number of bits required for address = "+bits);
int mask = 32-bits;
System.out.println("The subnet mask is = "+mask);

//Calculation of first address and last address


int fbip[] = new int[32];
for(int i=0; i<32;i++) fbip[i] = (int)bip.charAt(i)-48; //convert cahracter 0,1
to integer 0,1
for(int i=31;i>31-bits;i--)//Get first address by ANDing last n bits with 0
fbip[i] &= 0;
String fip[] ={"","","",""};
for(int i=0;i<32;i++)
fip[i/8] = new String(fip[i/8]+fbip[i]);
System.out.print("Subnet address is = ");
for(int i=0;i<4;i++){
System.out.print(Integer.parseInt(fip[i],2));
if(i!=3) System.out.print(".");
}
System.out.println();

int lbip[] = new int[32];


for(int i=0; i<32;i++) lbip[i] = (int)bip.charAt(i)-48; //convert cahracter 0,1
to integer 0,1
for(int i=31;i>31-bits;i--)//Get last address by ORing last n bits with 1
lbip[i] |= 1;
String lip[] = {"","","",""};
for(int i=0;i<32;i++)
lip[i/8] = new String(lip[i/8]+lbip[i]);
System.out.print("Broadcast address is = ");
for(int i=0;i<4;i++){
System.out.print(Integer.parseInt(lip[i],2));
if(i!=3) System.out.print(".");
}
System.out.println();
}
static String appendZeros(String s)
{
String temp = new String("00000000");
return temp.substring(s.length())+ s;
}
}

34
Lab Assignment : 7
Title : TCP Socket Programming (Using C)

PROBLEM STATEMENT:
Write a program using TCP socket for wired network for following
a. Say Hello to Each other ( For all students)
b. File transfer ( For all students)
c. Calculator (Arithmetic) (50% students)
d. Calculator (Trigonometry) (50% students)
Demonstrate the packets captured traces using Wireshark Packet Analyzer Tool for peer to
peer mode.

THEORY:
LINUX SOCKET PROGRAMMING

The Berkeley socket interface, an API, allows communications between hosts or between processes on one
computer, using the concept of a socket. It can work with many different I/O devices and drivers, although
support for these depends on the operating system.

implementation. This interface implementation is implicit for TCP/IP, and it is therefore one of the fundamental
technologies underlying the Internet. It was first developed at the University of California, Berkeley for use on
Unix systems. All modern operating systems now have some implementation of the Berkeley socket interface,
as it has become the standard interface for connecting to the Internet.

Programmers can make the socket interfaces accessible at three different levels, most powerfully and
fundamentally at the RAW socket level. Very few applications need the degree of control over outgoing
communications that this provides, so RAW sockets support was intended to be available only on computers
used for developing Internet related technologies.

In recent years, most operating systems have implemented support for it anyway, including Windows XP.

The header files

The Berkeley socket development library has many associated header files. They include:

<sys/socket.h>
Definitions for the most basic of socket structures with the BSD socket API
<sys/types.h>
Basic data types associated with structures within the BSD socket API
<netinet/in.h>
Definitions for the socketaddr_in{} and other base data structures.
<sys/un.h>
Definitions and data type declarations for SOCK_UNIX streams

TCP

35
TCP provides the concept of a connection. A process creates a TCP socket by calling the
socket() function with the parameters PF_INET or PF_INET6 and SOCK_STREAM.

Server
Setting up a simple TCP server involves the following steps:
Creating a TCP socket, with a call to socket().
Binding the socket to the listen port, with a call to bind().
Before calling bind(), a programmer must declare a sockaddr_in structure, clear it (with bzero() or memset()),
and the sin_family (AF_INET or AF_INET6), and fill its sin_port (the listening port, in network byte order)
fields.
Converting a short int to network byte order can be done by calling the function htons() (host to network
short). Preparing the socket to listen for connections (making it a listening socket), with a call to listen().
Accepting incoming connections, via a call to accept(). This blocks until an incoming connection is received,
and then returns a socket descriptor for the accepted connection. The initial descriptor remains a listening
descriptor, and accept() can be called again at any time with this socket, until it is closed. Communicating with
the remote host, which can be done through send() and recv().
Eventually closing each socket that was opened, once it is no longer needed, using close(). Note that if there
were any calls to fork(), each process must close the sockets it knew about (the kernel keeps track of how many
processes have a descriptor open), and two processes should not use the same socket at once.

Client
Setting up a TCP client involves the following steps:
 Creating a TCP socket, with a call to socket().
 Connecting to the server with the use of connect, passing a sockaddr_in structure
with the sin_family set to AF_INET or AF_INET6, sin_port set to the port the
endpoint is listening (in network byte order), and sin_addr set to the IPv4 or IPv6
address of the listening server (also in network byte order.)
 Communicating with the server by send()ing and recv()ing.
 Terminating the connection and cleaning up with a call to close(). Again, if there
 were any calls to fork(), each process must close() the socket.

Functions
socket()

socket() creates an endpoint for communication and returns a descriptor. socket() takes
three arguments:
domain, which specifies the protocol family of the created socket. For example:
o PF_INET for network protocol IPv4 or
o PF_INET6 for IPv6).
type, one of:
o SOCK_STREAM (reliable stream-oriented service)
o SOCK_DGRAM (datagram service)
o SOCK_SEQPACKET (reliable sequenced packet service), or
o SOCK_RAW (raw protocols atop the network layer).
protocol, usually set to 0 to represent the default transport protocol for the
specified domain and type values (TCP for PF_INET or PF_INET6 and
SOCK_STREAM, UDP for those PF_ values and SOCK_DGRAM), but which
can also explicitly specify a protocol.

The function returns -1 if an error occurred. Otherwise, it returns an integer representing


the newly-assigned descriptor.
36
Prototype:
int socket(int domain, int type, int protocol);
connect()
connect() It returns an integer representing the error code: 0 represents success, while -1
represents an error.
Certain types of sockets are connectionless, most commonly user datagram protocol
sockets. For these sockets, connect takes on a special meaning: the default target for
sending and receiving data gets set to the given address, allowing the use of functions
such as send() and recv() on connectionless sockets.

Prototype:
int connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen);

bind()
bind() assigns a socket an address. When a socket is created using socket(), it is given an
address family, but not assigned an address. Before a socket may accept incoming
connections, it must be bound. bind() takes three arguments:
sockfd, a descriptor representing the socket to perform the bind on
my_addr, a pointer to a sockaddr structure representing the address to bind to.
addrlen, a socklen_t field representing the length of the sockaddr structure.

It returns 0 on success and -1 if an error occurs.


Prototype:
int bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);

listen()
listen() prepares a bound socket to accept incoming connections. This function is only
applicable to the SOCK_STREAM and SOCK_SEQPACKET socket types. It takes two
arguments:
sockfd, a valid socket descriptor.
backlog, an integer representing the number of pending connections that can be
queued up at any one time. The operating system usually places a cap on this
value.
Once a connection is accepted, it is dequeued. On success, 0 is returned. If an error
occurs, -1 is returned.
Prototype:
int listen(int sockfd, int backlog);
accept()
Programmers use accept() to accept a connection request from a remote host. It takes the
following arguments:
sockfd, the descriptor of the listening socket to accept the connection from.
cliaddr, a pointer to the sockaddr structure that accept() should put the client's
address information into.
addrlen, a pointer to the socklen_t integer that will indicate to accept() how large
the sockaddr structure pointed to by cliaddr is. When accept() returns, the socklen_t integer then indicates how
many bytes of the cliaddr structure were
actually used.
The function returns a socket corresponding to the accepted connection, or -1 if an error
occurs.
Prototype:
int accept(int sockfd, struct sockaddr *cliaddr, socklen_t *addrlen);

37
Blocking vs. nonblocking
Berkeley sockets can operate in one of two modes: blocking or non-blocking. A blocking
socket will not "return" until it has sent (or received) all the data specified for the
operation. This may cause problems if a socket continues to listen: a program may hang
as the socket waits for data that may never arrive.
A socket is typically set to blocking or nonblocking mode using the fcntl() or ioctl()
functions.

Cleaning up
The system will not release the resources allocated by the socket() call until a close() call
occurs. This is especially important if the connect() call fails and may be retried. Each
call to socket() must have a matching call to close() in all possible execution paths.

Conclusion : TCP Socket has been created successfully and transferred file successfully. Arithmetic
operation performed successfully.
// Hello Client Side

#include<sys/types.h>
#include<sys/socket.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<stdlib.h>

#define buffsize 150

int main(void)
{
struct sockaddr_in clientaddr;
char recvline[buffsize];
int sockfd,n;
if((sockfd=socket(AF_INET,SOCK_STREAM,0))<0)
perror("Socket Creation Error.\n");
else
printf("Socket Created Successfully\n");
bzero((char *) &clientaddr, sizeof(clientaddr));
clientaddr.sin_family=AF_INET;
clientaddr.sin_addr.s_addr=inet_addr("127.0.0.1");
clientaddr.sin_port=htons(5000);
if(connect(sockfd,(struct sockaddr *) &clientaddr, sizeof(clientaddr)) < 0 )
perror("Connect error\n");
else
printf("Connected successfully\n");
while(( n = read(sockfd,recvline,buffsize)) > 0 )
{
recvline[n]=0;
if(fputs(recvline,stdout)==EOF)
perror("fputs Error.\n");
}
if(n < 0)
perror("Read Error\n");
exit(0);

38
}

// Hello Server-Side Program

#include<sys/types.h>
#include<sys/socket.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<netinet/in.h>
#include<stdlib.h>

#define buffsize 150

int main(void)
{
struct sockaddr_in servaddr,clientaddr;
char buff[buffsize],crcbuff[buffsize];
int listenfd,connfd;
int sin_size;

if((listenfd=socket(AF_INET,SOCK_STREAM,0))==-1)
perror("Socket Creation Error.\n");
else
printf("Socket Created Successfully\n");
bzero((char *) &servaddr, sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=inet_addr("127.0.0.1");
servaddr.sin_port=htons(5000);
if(bind(listenfd, (struct sockaddr *)&servaddr,sizeof(servaddr)) == -1)
perror("Bind Error\n");
listen(listenfd,4);
sin_size = sizeof(struct sockaddr_in);
for(;;)
{
if((connfd=accept(listenfd,(struct sockaddr *)&clientaddr,
&sin_size))==-1)
perror("Accept Error\n");
strcpy(buff,"Hello Client - Server\n");
write(connfd,buff,strlen(buff));
close(connfd);
}
}

39
Lab Assignment : 8

TITLE: UDP Socket programming in Linux (Using C)

PROBLEM STATEMENT

Write a program using UDP Sockets to enable file transfer (Script, Text, Audio and Video one file each)
between two machines.

THEORY :

LINUX SOCKET PROGRAMMING

The Berkeley socket interface, an API, allows communications between hosts or between processes on one
computer, using the concept of a socket. It can work with many different I/O devices and drivers, although
support for these depends on the operating system .

implementation. This interface implementation is implicit for TCP/IP, and it is therefore one of the fundamental
technologies underlying the Internet. It was first developed at the University of California, Berkeley for use on
Unix systems. All modern operating systems now have some implementation of the Berkeley socket interface,
as it has become the standard interface for connecting to the Internet.

Programmers can make the socket interfaces accessible at three different levels, most powerfully and
fundamentally at the RAW socket level. Very few applications need the degree of control over outgoing
communications that this provides, so RAW sockets support was intended to be available only on computers
used for developing Internet related technologies.

In recent years, most operating systems have implemented support for it anyway, including Windows XP.

The header files

The Berkeley socket development library has many associated header files. They include:

<sys/socket.h>
Definitions for the most basic of socket structures with the BSD socket API
<sys/types.h>
Basic data types associated with structures within the BSD socket API
<netinet/in.h>
Definitions for the socketaddr_in{} and other base data structures.
<sys/un.h>
Definitions and data type declarations for SOCK_UNIX streams

UDP

UDP consists of a connectionless protocol with no guarantee of delivery. UDP packets


may arrive out of order, become duplicated and arrive more than once, or even not arrive
at all. Due to the minimal guarantees involved, UDP has considerably less overhead than
40
TCP. Being connectionless means that there is no concept of a stream or connection
between two hosts, instead, data arrives in datagrams.

UDP address space, the space of UDP port numbers (in ISO terminology, the TSAPs), is
completely disjoint from that of TCP ports.

Server

Code may set up a UDP server on port 7654 as follows:

sock = socket(PF_INET,SOCK_DGRAM,0);

sa.sin_addr.s_addr = INADDR_ANY;
sa.sin_port = htons(7654);

bound = bind(sock,(struct sockaddr *)&sa, sizeof(struct sockaddr));


if (bound < 0)
fprintf(stderr, "bind(): %s\n",strerror(errno));
listen(sock,3);

bind() binds the socket to an address/port pair. listen() sets the length of the new
connections queue.

while (1) {
printf ("recv test....\n");
recsize = recvfrom(sock, (void *)hz, 100, 0, (struct sockaddr *)&sa,
fromlen);
printf ("recsize: %d\n ",recsize);
if (recsize < 0)
fprintf(stderr, "%s\n", strerror(errno));
sleep(1);
printf("datagram: %s\n",hz);
}

This infinite loop receives any UDP datagrams to port 7654 using recvfrom(). It uses the
parameters:

socket
pointer to buffer for data
size of buffer

flags (same as in read or other receive socket function)


address struct of sending peer
length of address struct of sending peer.
Client

A simple demo to send an UDP packet containing "Hello World!" to address 127.0.0.1,
port 7654 might look like this:

41
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>

int main(int argc, char *argv[])


{
int sock;
struct sockaddr_in sa;
int bytes_sent, buffer_length;
char buffer[200];

sprintf(buffer, "Hello World!");


buffer_length = strlen(buffer) + 1;

sock = socket(PF_INET, SOCK_DGRAM, 0);

sa.sin_family = AF_INET;
sa.sin_addr.s_addr = htonl(0x7F000001);
sa.sin_port = htons(7654);

bytes_sent = sendto(sock, buffer, buffer_length, 0, &sa, sizeof(struct


sockaddr_in) );
if(bytes_sent < 0)
printf("Error sending packet: %s\n", strerror(errno) );

return 0;
}
In this code, buffer provides a pointer to the data to send, and buffer_length specifies the
size of the buffer contents.
UDP Socket Programming in JAVA:
Creating UDP sockets.
• Client
• Server
•java.net.DatagramSocket class
Creating a UDP packet
// to receive data from a remote machine
DatagramPacket packet = new DatagramPacket(new byte[256], 256);
// to send data to a remote machine
DatagramPacket packet = new DatagramPacket( new byte[128], 128, address, port );
A UDP socket can be used both for reading and writing packets.
• Write operations are asynchronous; however, read operations are blocking.
• Since there is no guaranteed delivery, a single-threaded application could stall.
// A client datagram socket:
DatagramSocket clientSocket =new DatagramSocket();
// A server datagram socket:
DatagramSocket serverSocket =new DatagramSocket(port);
Listening for UDP Packets
// create datagram packet

42
// create datagram server socket
boolean finished = false;
while ( ! finished )
serverSocket.receive (packet);
// process the packet
serverSocket.close();

Processing UDP Packets


ByteArrayInputStream bin =new ByteArrayInputStream(packet.getData() );
DataInputStream din =new DataInputStream(bin);
// read the contents of the packet
Sending UDP Packets
// create datagram packet
// create datagram client socket
boolean finished = false;
while ( ! finished )
// write data to packet buffer
clientSocket.send (packet);
// see if there is more to send

When you receive a packet, the ip and port number of the sender are set in the
DatagramPacket.
• You can use the same packet to reply, by overwriting the data, using the method:
•packet.setData(newbuffer);

Non-blocking I/O receiving UDP packets

• You can set a time-out in milliseconds to determine how long a read operation blocks,
before throwing an exception.
•socket.setSoTimeout(duration);
• If the duration given in milliseconds is exceeded, an exception is thrown:
•java.io.InterruptedException

Typical UDP client code


Create UDP socket to contact server (with a given hostname and service port
number)
• Create UDP packet.
• Call send(packet), sending request to the server.
• Possibly call receive(packet) (if we need a reply).

Typical UDP Server code

• Create UDP socket listening to a well known port number.


• Create UDP packet buffer
• Call receive(packet) to get a request, noting the address of the client.
• Process request and send reply back with send(packet).

Conclusion : UDP Socket has been created successfully and transferred file successfully. Arithmetic
operation performed successfully.

43
//Hello UDP Client
#include<sys/types.h>
#include<sys/socket.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<stdlib.h>

#define buffsize 150

int main(void)
{
struct sockaddr_in clientaddr;
char buff[buffsize];
int sockfd,n;
if((sockfd=socket(AF_INET,SOCK_DGRAM,0))<0)
perror("Socket Creation Error.\n");
else
printf("Socket Created Successfully\n");
bzero((char *) &clientaddr, sizeof(clientaddr));
clientaddr.sin_family=AF_INET;
clientaddr.sin_addr.s_addr=inet_addr("127.0.0.1");
clientaddr.sin_port=htons(5000);
if(connect(sockfd,(struct sockaddr *) &clientaddr, sizeof(clientaddr)) < 0 )
perror("Connect error\n");
else
printf("Connected successfully\n");
strcpy(buff,"Hello Server\n");

if(sendto(sockfd,buff,buffsize,0,
(struct sockaddr *) &clientaddr, sizeof(clientaddr)) != buffsize)

perror("Send error\n");
else
{
printf("Buffer has sent successfully\n");
printf("%s\n",buff);
}

close(sockfd);

// Hello UDP Server

#include<sys/types.h>
#include<sys/socket.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<netinet/in.h>
#include<stdlib.h>
44
#define buffsize 150

int main(void)
{
struct sockaddr_in servaddr,clientaddr;
char buff[buffsize],crcbuff[buffsize];
int listenfd,connfd;
int sin_size;

if((listenfd=socket(AF_INET,SOCK_DGRAM,0))==-1)
perror("Socket Creation Error.\n");
else
printf("Socket Created Successfully\n");
bzero((char *) &servaddr, sizeof(servaddr));
servaddr.sin_family=AF_INET;
servaddr.sin_addr.s_addr=inet_addr("127.0.0.1");
servaddr.sin_port=htons(5000);
if(bind(listenfd, (struct sockaddr *)&servaddr,sizeof(servaddr)) == -1)
perror("Bind Error\n");
listen(listenfd,4);
sin_size = sizeof(struct sockaddr_in);
for(;;)
{
if(recvfrom(listenfd,buff,buffsize,0,
(struct sockaddr *) &clientaddr, &sin_size) != buffsize)
perror("recvfrom error\n");
else
printf("%s\n",buff);

}
close(connfd);
}

45
Lab Assignment : 9

Title : Capture packets using Wireshark


PROBLEM STATEMENT:

Write the exact packet capture filter expressions to accomplish the following and save the output in file:

1. Capture all TCP traffic to/from Facebook, during the time when you log in to your Facebook account

2. Capture all HTTP traffic to/from Facebook, when you log in to your Facebook account

3. Write a DISPLAY filter expression to count all TCP packets (captured under item #1) that have the flags
SYN, PSH, and RST set. Show the fraction of packets that had each flag set.

4. Count how many TCP packets you received from / sent to Face book, and how many of each were also HTTP
packet

THEORY
Wireshark, a network analysis tool formerly known as Ethereal, captures packets in real time and display them
in human-readable format. Wireshark includes filters, color coding, and other features that let you dig deep into
network traffic and inspect individual packets.

This tutorial will get you up to speed with the basics of capturing packets, filtering them, and inspecting them.
You can use Wireshark to inspect a suspicious program’s network traffic, analyze the traffic flow on your
network, or troubleshoot network problems.

You can download Wireshark for Windows or macOS from

https://www.wireshark.org/

If you’re using Linux or another UNIX-like system, you’ll probably find Wireshark in its package repositories.
For example, if you’re using Ubuntu, you’ll find Wireshark in the Ubuntu Software Center.

Just a quick warning: Many organizations don’t allow Wireshark and similar tools on their networks. Don’t use
this tool at work unless you have permission.
46
CAPTURING PACKETS

After downloading and installing Wireshark, you can launch it and double-click the name of a network
interface under Capture to start capturing packets on that interface. For example, if you want to capture traffic
on your wireless network, click your wireless interface. You can configure advanced features by clicking
Capture > Options, but this isn’t necessary for now.

As soon as you click the interface’s name, you’ll see the packets start to appear in real time. Wireshark
captures each packet sent to or from your system.

47
If you have promiscuous mode enabled—it’s enabled by default—you’ll also see all the other packets on the
network instead of only packets addressed to your network adapter. To check if promiscuous mode is enabled,
click Capture > Options and verify the “Enable promiscuous mode on all interfaces” checkbox is activated at
the bottom of this window.

Click the red “Stop” button near the top left corner of the window when you want to stop capturing traffic.

Color Coding

48
You’ll probably see packets highlighted in a variety of different colors. Wireshark uses colors to help you
identify the types of traffic at a glance. By default, light purple is TCP traffic, light blue is UDP traffic, and
black identifies packets with errors—for example, they could have been delivered out of order.

To view exactly what the color codes mean, click View > Coloring Rules. You can also customize and modify
the coloring rules from here, if you like.

If there’s nothing interesting on your own network to inspect, Wireshark’s wiki has you covered. The wiki
contains a page of sample capture files that you can load and inspect. Click File > Open in Wireshark and
browse for your downloaded file to open one.

You can also save your own captures in Wireshark and open them later. Click File > Save to save your
captured packets.

Filtering Packets

49
If you’re trying to inspect something specific, such as the traffic a program sends when phoning home, it helps
to close down all other applications using the network so you can narrow down the traffic. Still, you’ll likely
have a large amount of packets to sift through. That’s where Wireshark’s filters come in.

The most basic way to apply a filter is by typing it into the filter box at the top of the window and clicking
Apply (or pressing Enter). For example, type “dns” and you’ll see only DNS packets. When you start typing,
Wireshark will help you autocomplete your filter.

You can also click Analyze > Display Filters to choose a filter from among the default filters included
in Wireshark. From here, you can add your own custom filters and save them to easily access them
in the future.

For more information on Wireshark’s display filtering language, read the Building display filter
expressions page in the official Wireshark documentation.

Another interesting thing you can do is right-click a packet and select Follow > TCP Stream.

You’ll see the full TCP conversation between the client and the server. You can also click other protocols in
the Follow menu to see the full conversations for other protocols, if applicable.

50
Close the window and you’ll find a filter has been applied automatically. Wireshark is showing you the
packets that make up the conversation.

INSPECTING PACKETS
Click a packet to select it and you can dig down to view its details.

51
You can also create filters from here — just right-click one of the details and use the Apply as Filter submenu
to create a filter based on it.

Wireshark is an extremely powerful tool, and this tutorial is just scratching the surface of what you can do
with it. Professionals use it to debug network protocol implementations, examine security problems and
inspect network protocol internals.

CONCLUSION
52
Packets are captured using Wireshark, and packet capture filter expressions are written to accomplish the
given task

OUTPUT/SCREENSHOT

TCP TRAFFIC

HTTP TRAFFIC

53
Lab Assignment : 10

Title : DNS Lookup


PROBLEM STATEMENT:

Write a program for DNS lookup. Given an IP address as input, it should return URL and vice-versa

THEORY:
The Domain Name Server is

• A globally distributed, scalable, reliable database

• Comprised of three components

– A “name space”

– Servers making that name space available

– Resolvers (clients) which query the servers about the name space

DNS as a Lookup Mechanism

• Users generally prefer names to numbersn

• Computers prefer numbers to names

• DNS provides the mapping between the two

– I have “x”, give me “y”

• Keys to the database are “domain names”

– www.foo.com, 18.in-addr.arpa, 6.4.e164.arpa

• Over 200,000,000 domain names stored

• Each domain name contains one or more attributes

– Known as “resource records”

• Each attribute individually retrievable

• Data is maintained locally, but retrievable globally

– No single computer has all DNS data

• DNS lookups can be performed by any device

• Remote DNS data is locally cachable to improve performance

54
In computer networks, a reverse DNS lookup or reverse DNS resolution (rDNS) is the querying of the Domain Name
System (DNS) to determine the domain name associated with an IP address – the reverse of the usual "forward" DNS lookup
of an IP address from a domain name. The process of reverse resolving an IP address uses PTR records. The reverse DNS
database of the Internet is rooted in the arpa top-level domain.

Uses
The most common uses of the reverse DNS include:
● The original use of the rDNS: network troubleshooting via tools such as traceroute, ping, and the "Received:" trace
header field for SMTP e-mail, web sites tracking users (especially on Internet forums), etc.

● One e-mail anti-spam technique: checking the domain names in the rDNS to see if they are likely from dialup users, or
dynamically assigned addresses unlikely to be used by legitimate mail servers. Owners of such IP addresses typically
assign them generic rDNS names such as "1-2-3-4-dynamic-ip.example.com." Some anti-spam filters assume that email
that originates from such addresses is likely to be spam, and may refuse connection.[5][6]

● A forward-confirmed reverse DNS (FCrDNS) verification can create a form of authentication showing a valid
relationship between the owner of a domain name and the owner of the server that has been given an IP address.

● System logging or monitoring tools often receive entries with the relevant devices specified only by IP addresses. To
provide more human-usable data, these programs often perform a reverse lookup before writing the log, thus writing a
name rather than the IP address.

Conclusion: DNS Lookup program executed successfully.

/* DNS LookUP*/
// Print out DNS Record for an Internet Address
import javax.naming.directory.Attributes;
import javax.naming.directory.InitialDirContext;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Scanner;
public class DNSLookup
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String arg;

try
{
InetAddress inetAddress;

System.out.println("Enter Domain name or domain address");


arg=sc.next();
inetAddress = InetAddress.getByName(arg);
System.out.println(inetAddress);
// show the Internet Address as name/address

55
System.out.println(inetAddress.getHostName() + "/" +
inetAddress.getHostAddress());
// get the default initial Directory Context
InitialDirContext iDirC = new InitialDirContext();
// get the DNS records for inetAddress
Attributes attributes = iDirC.getAttributes("dns:/" +
inetAddress.getHostName());
// get an enumeration of the attributes and print them out
NamingEnumeration attributeEnumeration = attributes.getAll();
System.out.println("-- DNS INFORMATION --");
while (attributeEnumeration.hasMore())
{
System.out.println("" + attributeEnumeration.next());
}
attributeEnumeration.close();
}
catch (UnknownHostException exception)
{
System.err.println("ERROR: No Internet Address ");
}
catch (NamingException exception)
{
System.err.println("ERROR: No DNS record");
}
}
}

56
Assignment 11

Study and analyze the performance of HTTP, HTTPS and FTP protocol using Packet tracer tool.

PROBLEM STATEMENT

Study and Analyze the performance of HTTP, HTTPS and FTP protocol using Packet tracer tool

THEORY:

HTTP

HTTP is a protocol for fetching resources such as HTML documents. It is the foundation of any data exchange
on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the
Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance,
text, layout description, images, videos, scripts, and more.

57
Clients and servers communicate by exchanging individual messages (as opposed to a stream of data). The
messages sent by the client, usually a Web browser, are called requests and the messages sent by the server as
an answer are called responses.

Designed in the early 1990s, HTTP is an extensible protocol which has evolved over time. It is an application
layer protocol that is sent over TCP, or over a TLS-encrypted TCP connection, though any reliable transport
protocol could theoretically be used. Due to its extensibility, it is used to not only fetch hypertext documents,
but also images and videos or to post content to servers, like with HTML form results. HTTP can also be used

to fetch parts of documents to update Web pages on demand.

Components of HTTP-based systems

HTTP is a client-server protocol: requests are sent by one entity, the user-agent (or a proxy on behalf of it).
Most of the time the user-agent is a Web browser, but it can be anything, for example, a robot that crawls the
Web to populate and maintain a search engine index.

58
Each individual request is sent to a server, which handles it and provides an answer called the response. Between
the client and the server there are numerous entities, collectively called proxies, which perform different
operations and act as gateways or caches, for example.

What is HTTPS?

HTTPS (Hypertext Transfer Protocol Secure) is a secure version of the HTTP protocol that uses the SSL/TLS
protocol for encryption and authentication. HTTPS is specified by RFC 2818 (May 2000) and uses port 443 by
default instead of HTTP’s port 80.

The HTTPS protocol makes it possible for website users to transmit sensitive data such as credit card numbers,
banking information, and login credentials securely over the internet. For this reason, HTTPS is especially
important for securing online activities such as shopping, banking, and remote work. However, HTTPS is
quickly becoming the standard protocol for all websites, whether or not they exchange sensitive data with users.

How is HTTPS different from HTTP?

HTTPS adds encryption, authentication, and integrity to the HTTP protocol:

Encryption: Because HTTP was originally designed as a clear text protocol, it is vulnerable to eavesdropping
and man in the middle attacks. By including SSL/TLS encryption, HTTPS prevents data sent over the internet
from being intercepted and read by a third party. Through public-key cryptography and the SSL/TLS handshake,

59
an encrypted communication session can be securely set up between two parties who have never met in person
(e.g. a web server and browser) via the creation of a shared secret key.

Authentication: Unlike HTTP, HTTPS includes robust authentication via the SSL/TLS protocol. A website’s
SSL/TLS certificate includes a public key that a web browser can use to confirm that documents sent by the
server (such as HTML pages) have been digitally signed by someone in possession of the corresponding private
key. If the server’s certificate has been signed by a publicly trusted certificate authority (CA), such as SSL.com,
the browser will accept that any identifying information included in the certificate has been validated by a
trusted third party.

HTTPS websites can also be configured for mutual authentication, in which a web browser presents a client
certificate identifying the user. Mutual authentication is useful for situations such as remote work, where it is
desirable to include multi-factor authentication, reducing the risk of phishing or other attacks involving
credential theft. For more information on configuring client certificates in web browsers, please read this how-
to.

Integrity: Each document (such as a web page, image, or JavaScript file) sent to a browser by an HTTPS web
server includes a digital signature that a web browser can use to determine that the document has not been
altered by a third party or otherwise corrupted while in transit. The server calculates a cryptographic hash of the
document’s contents, included with its digital certificate, which the browser can independently calculate to
prove that the document’s integrity is intact.

Taken together, these guarantees of encryption, authentication, and integrity make HTTPS a much safer protocol
for browsing and conducting business on the web than HTTP.

FTP

60
File Transfer Protocol (FTP) is an application layer protocol that moves files between local and remote file
systems. It runs on the top of TCP, like HTTP. To transfer a file, 2 TCP connections are used by FTP in parallel:
control connection and data connection.

What is control connection?


For sending control information like user identification, password, commands to change the remote
directory, commands to retrieve and store files, etc., FTP makes use of control connection. The control
connection is initiated on port number 21.

What is data connection?


For sending the actual file, FTP makes use of a data connection. A data connection is initiated on port
number 20.
FTP sends the control information out-of-band as it uses a separate control connection. Some protocols send
their request and response header lines and the data in the same TCP connection. For this reason, they are
said to send their control information in-band. HTTP and SMTP are such examples.

FTP Session:
When an FTP session is started between a client and a server, the client initiates a control TCP connection
with the server-side. The client sends control information over this. When the server receives this, it initiates
a data connection to the client-side. Only one file can be sent over one data connection. But the control

61
connection remains active throughout the user session. As we know HTTP is stateless i.e. it does not have to
keep track of any user state. But FTP needs to maintain a state about its user throughout the session.

Data Structures: FTP allows three types of data structures:

1. File Structure – In file-structure there is no internal structure and the file is considered to be a
continuous sequence of data bytes.
2. Record Structure – In record-structure the file is made up of sequential records.
3. Page Structure – In page-structure the file is made up of independent indexed pages.

CONCLUSION

Studied the performance of HTTP, HTTPS and FTP protocol using Packet tracer tool.

OUTPUT

62
63
Lab Assignment 12

TITLE

To study the SSL protocol by capturing the packets using Wireshark tool while visiting any
SSL secured website (banking, e-commerce etc.)
PROBLEM STATEMENT

Retrieve SSL protocol by capturing the packets using Wireshark

THEORY

SSL, or Secure Sockets Layer, is an encryption-based Internet security protocol. It was first
developed by Netscape in 1995 for the purpose of ensuring privacy, authentication, and data
integrity in Internet communications. SSL is the predecessor to the modern TLS encryption
used today.

How does SSL/TLS work?

In order to provide a high degree of privacy, SSL encrypts data that is transmitted across the
web. This means that anyone who tries to intercept this data will only see a garbled mix of
characters that is nearly impossible to decrypt.
SSL initiates an authentication process called a handshake between two communicating
devices to ensure that both devices are really who they claim to be.
SSL also digitally signs data in order to provide data integrity, verifying that the data is not
tampered with before reaching its intended recipient.
There have been several iterations of SSL, each more secure than the last. In 1999 SSL was
updated to become TLS.

Why is SSL/TLS important?

Originally, data on the Web was transmitted in plaintext that anyone could read if they
intercepted the message. For example, if a consumer visited a shopping website, placed an
order, and entered their credit card number on the website, that credit card number would
64
travel across the Internet unconcealed.

SSL was created to correct this problem and protect user privacy. By encrypting any data
that goes between a user and a web server, SSL ensures that anyone who intercepts the data
can only see a scrambled mess of characters. The consumer's credit card number is now safe,
only visible to the shopping website where they entered it.
SSL also stops certain kinds of cyber-attacks: It authenticates web servers, which is important
because attackers will often try to set up fake websites to trick users and steal data. It also
prevents attackers from tampering with data in transit, like a tamper-proof seal on a medicine
container.

Are SSL and TLS the same thing?

SSL is the direct predecessor of another protocol called TLS (Transport Layer Security). In
1999 the Internet Engineering Task Force (IETF) proposed an update to SSL. Since this
update was being developed by the IETF and Netscape was no longer involved, the name
was changed to TLS. The differences between the final version of SSL (3.0) and the first
version of TLS are not drastic; the name change was applied to signify the change in
ownership.

Since they are so closely related, the two terms are often used interchangeably and confused.
Some people still use SSL to refer to TLS, others use the term "SSL/TLS encryption" because
SSL still has so much name recognition.

CONCLUSION

Studied SSL protocol by capturing the packets using Wireshark tool whilevisiting any SSL
secured website

OUTPUT/SCREENSHOT

65
66
67

You might also like