Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Lab Manual
Prepared by,
2. Problem analysis: Identify, formulate, research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools, including prediction and modeling to complex engineering activities,
with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to
the professional engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader
in diverse teams, and in multidisciplinary settings.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
COURSE OBJECTIVES:
COURSE OUTCOME:
Course Objectives:
1. To establish communication among the computing nodes in P2P and Client-Server
architecture
2. Configure the computing nodes with understanding of protocols and technologies
3. Use different communicating modes and standards for communication
4. Use modern tools for network traffic analysis
5. To learn network programming.
Course Outcomes:
On completion of the course, student will be able to–
Software’s required
Part A: Setup a wired LAN using Layer 2 Switch and then IP switch of minimum four
computers. It includes preparation of cable, testing of cable using line tester, configuration
machine using IP addresses, testing using PING utility and demonstrate the PING packets
captured traces using Wireshark Packet Analyzer Tool.Part B: Extend the same Assignment for
Wireless using Access Point
Write a Program with following four options to transfer between two RS 232D or USB ports
using C/C++.
Write a program for error detection and correction for 7/8 bits ASCII codes using Hamming
Codes or CRC. Demonstrate the packets captured traces using Wireshark Packet Analyzer Tool
for peer to peer mode.
4. Lab Assignment on Unit II: (Use JAVA/PYTHON)
Write a program to simulate Go back N and Selective Repeat Modes of Sliding Window Protocol
in peer to peer mode and demonstrate the packets captured traces using Wireshark Packet
Analyzer Tool for peer to peer mode.
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)
8. Demonstrate the packets captured traces using Wireshark Packet Analyzer Tool for peer to
peer mode.
Write a program using UDP Sockets to enable file transfer (Script, Text, Audio and Video one
file each) between two machines. Demonstrate the packets captured traces using Wireshark
Packet Analyzer Tool for peer to peer mode.
11. Write a program to simulate the behavior of Slow Start and AIMD (Additive Increase and
Multiplicative Decrease) congestion control protocols. (Use JAVA/ PYTHON)
Group B
Study of any network simulation tools - To create a network with three nodes and establish a
TCP connection between node 0 and node 1 such that node 0 will send TCP packet to node 2 via
node 1.
Demonstrate the packets captured traces using Wireshark Packet Analyzer Tool for peer to peer
mode.
Demonstrate the packets captured traces using Wireshark Packet Analyzer Tool for peer to
peer mode.
c. Network Routing: Shortest path routing, AODV. d. Analysis of congestion control (TCP and
UDP).
INDEX
● Group:
● ASSIGNMENT NO.
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
● TITLE :
● PROBLEM STATEMENT
● PREREQUISITES
● COURSE OBJECTIVES
● COURSE OUTCOMES
● THEORY(in brief)
● ALGORITHM
● CONCLUSION:
● FAQs:
Group A
Assignment No. 1
AIM : Setup a wired LAN using Layer 2 Switch and wireless LAN using Access point.
PROBLEM STATEMENT: Part A: Setup a wired LAN using Layer 2 Switch and then IP
switch of minimum four computers. It includes preparation of cable, testing of cable using line
tester, configuration machine using IP addresses, testing using PING utility and demonstrate the
PING packets captured traces using Wireshark Packet Analyzer Tool.
COURSE OBJECTIVES: To understand and setup a wired and wireless LAN and configuring
the nodes.
COURSE OUTCOMES:
CO1: Demonstrate LAN and WAN protocol behavior using Modern Tools
THEORY:
To implement the cross-wired cable and straight through cable using crimping tool.
Components:
Procedure:
1. Start by stripping off about 2 inches of the plastic jacket off the end of the cable. Be very
careful at this point, as to not nick or cut into the wires, which are inside. Doing so could alter
the characteristics of wire cable, or even worse render is useless. Check the wires, one more time
for nicks or cuts. If there are any, just whack the whole end off, and start over.
2. Spread the wires apart, but be sure to hold onto the base of the jacket with wire in the other
hand. You do not want the wires to become untwisted down inside the jacket. Category 5 cable
must only have 1/2 of an inch of 'untwisted' wire at the end; otherwise it will be 'out of spec'. At
this point, we obviously have more than 1/2 of an inch of un-twisted wire.
3. We have 2 end jacks, which must be installed on our cable. If we are using a premade cable,
with one of the ends whacked off, we only have one end to install - the crossed over end. Below
are two diagrams, which show how we need to arrange the cables for each type of cable end.
Decide at this point which end we are making and examine the associated picture below.
Switch:
A switch or switching hub is a computer networking device that connects multiple nodes
together. Switches that additionally process data at the network layer (layer 3 and above) are
often referred to as Layer 3 switches or multilayer switches. The basic function that any switch is
supposed to perform is to receive information from any source connected to it and dispatch that
information to the appropriate destination only.
Access point
Wireless access points (APs or WAPs) are special-purpose communication devices on Wireless
Access LAN (WLAN). Access points act as a central transmitter and receiver of wireless radio
signals.
a. First, determine which cables are necessary for the available hardware
b. Insert one end of the cable into the Switch and the other end of the cable into the host
computer.
c. Connect all host computers to the Switch and configure the IP address to every host.
192.168.1.1 192.168.1.2 192.168.1.3
# ping 192.168.1.2
CONCLUSION:
FAQs:
Ans: Straight Cable Connect different types of devices together e.g.a computer to a switch/hub's
normal port. Crossover Cable Connect similar types of devices together e.g. 2 computers
directly.
Group: A
Assignment No.2
AIM : Write a program to implement Hamming Code and CRC.
PROBLEM STATEMENT: Write a program for error detection and correction for 7/8 bits
ASCII codes using Hamming Codes or CRC. Demonstrate the packets captured traces using
Wireshark Packet Analyzer Tool for peer to peer mode.
COURSE OUTCOMES:
CO2: Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
THEORY:
Hamming Code:
The most common types of error-correcting codes used in RAM are based on the codes devised
by R. W. Hamming. In the Hamming code, k parity bits are added to an n-bit data word, forming
a new word of n ϩ k bits. The bit positions are numbered in sequence from 1 to n ϩ k. Those
positions numbered with powers of two are reserved for the parity bits. The remaining bits are
the data bits. The code can be used with words of any length.
Before giving the general characteristics of the Hamming code, we will illustrate its operation
with a data word of eight bits. Consider, for example, the 8-bit data word 11000100. We include
four parity bits with this word and arrange the 12 bits as follows:
Bit position
1 2 3 4 5 6 7 8 9 10 11 12
P1 P2 1 P4 1 0 0 P8 0 1 0 0
The 4 parity bits P 1 through P 8 are in positions 1, 2, 4, and 8, respectively. The 8 bits of the data
word are in the remaining positions. Each parity bit is calculated as follows:
Thus, each parity bit is set so that the total number of 1’s in the checked positions, including the
parity bit, is always even.
The 8-bit data word is written into the memory together with the 4 parity bits as a 12-bit
composite word. Substituting the 4 parity bits in their proper positions, we obtain the 12-bit
composite word written into memory:
Bit position
1 2 3 4 5 6 7 8 9 10 11 12
0 0 1 1 1 0 0 1 0 1 0 0
When the 12 bits are read from memory, they are checked again for errors. The parity of the
word is checked over the same groups of bits, including their parity bits. The four check bits are
evaluated as follows:
A 0 check bit designates an even parity over the checked bits, and a 1 designates an odd parity.
Since the bits were written with even parity, the result, C = C8 C4 C2 C1 = 0000, indicates that
no error has occurred. However, if C ≠ 0 , the 4-bit binary number formed by the check bits gives
the position of the erroneous bit if only a single bit is in error.
Thus, for no error, we have C = 0000; with an error in bit 1, we obtain C = 0001;and with an
error in bit 5, we get C = 0101. Hence, when C is not equal to 0, the decimal value of C gives the
position of the bit in error. The error can then be corrected by complementing the corresponding
bit. Note that an error can occur in the data or in one of the parity bits.
Algorithm
The following general algorithm generates a single-error correcting (SEC) code for any number
of bits.
The form of the parity is irrelevant. Even parity is simpler from the perspective of theoretical
mathematics, but there is no difference in practice.
A cyclic redundancy check (CRC) is an error detecting codes commonly used in digital networks
and storage devices to detect accidental changes to raw data. Blocks of data entering these
systems get a short check value attached, based on the remainder of a polynomial division of
their contents. On retrieval, the calculation is repeated and, in the event the check values do not
match, corrective action can be taken against data corruption.
Application
A CRC-enabled device calculates a short, fixed-length binary sequence, known as the check
value or CRC, for each block of data to be sent or stored and appends it to the data, forming a
codeword. When a codeword is received or read, the device either compares its check value with
one freshly calculated from the data block, or equivalently, performs a CRC on the whole
codeword and compares the resulting check value with an expected residue constant.
If the CRC check values do not match, then the block contains a data error.
The device may take corrective action, such as rereading the block or requesting that it be sent
again. Otherwise, the data is assumed to be error-free (though, with some small probability, it
may contain undetected errors; this is the fundamental nature of error-checking). Compute an n-
In this example, we shall encode 14 bits of message with a 3-bit CRC, with a polynomial x3 + x +
1. The polynomial is written in binary as the coefficients; a 3rd-order polynomial has 4
coefficients (1x3 + 0x2 + 1x + 1). In this case, the coefficients are 1, 0, 1 and 1. The result of the
calculation is 3 bits long.
No shared memory
I= {Dataword,Generator/Divisor}
parity_calculate(),CRC(),XOR();
Where,
CONCLUSION:
FAQs:
Ans: The Hamming Distance is a number used to denote the difference between two binary
strings. Hamming's formulas allow computers to detect and correct error on their own.
Ans:
Odd parity: The number of 1-bit in the data word must add up to an odd number
Even parity: The number of 1-bit in the data word must add up to an even number
3. Give Even parity Example.
Ans: A single bit is appended to each data chunk makes the number of 1 bits even/odd
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
Example: even parity 1000000(1).
Ans: It is the min distance between all possible pairs of codewords. The number of errors that
can be detected will always be one less than the min hamming distance.
Ans: Error control involves retransmission of the lost, damaged, or corrupted frame.
Group:A
Assignment No: 3
AIM: Write a program to demonstrate subnetting and find the subnet masks.
COURSE OUTCOMES:.
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
THEORY
IP Address
Subnetting
Subnetting Principle
● To determine the number of subnets & hosts per subnet available for any of the
available subnet masks, 2 simple formulas to calculate these numbers:
● Number of Subnets=(2n)
● Number of Host per Subnets=(2h-2)
Example: Consider the network id 192.168.8.0 or such relevant IP and create five subnets
namely A, B, C, D. Assign the subnet mask. Determine number of bits used for Subnet and host.
To create four subnets namely A, B, C, D we consider Host ID bits. For four subnets we require
2 bits out of of 8 host id bits.
0 0 0 0 0 0 0 0
CONCLUSION:
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
Outcome of the experiment is students are able to divide the network using implement
subnetting.
FAQs:
Group: A
Assignment No.4
AIM: Write a program for DNS lookup. Given an IP address input, it should return URL and vice-versa.
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY:
DNS: Domain name system
A domain name is a meaningful name that identifies an internet address. DNS is a system where
these domain names are located.
DNS services
hostname to IP address translation v host aliasing
canonical, alias names v mail server aliasing v load distribution
replicated Web servers: many IP addresses correspond to one name
iterated query: v contacted server replies with name of server to contact v “I don’t know this
name, but ask this server
recursive query: v puts burden of name resolution on contacted name server v heavy load at
upper levels of hierarchy?
DNS records
DNS: distributed db storing resource records (RR)
type=NS
§ name is domain (e.g., foo.com)
§ value is hostname of authoritative name server for this domain
type=A
§ name is hostname
§ value is IP address
type=CNAME
§ name is alias name for some “canonical” (the real) name
§ www.ibm.com is really servereast.backup2.ibm.com
§ value is canonical name type=MX
§ value is name of mail server associated with name
Conclusion;
The outcome of the assignment is the students will be able to understand and implement DNS
lookup
FAQ’s
Group A
Assignment 5
PROBLEM STATEMENT: Lab Assignment on Unit V: (Mandatory Assignment) (Use C/C++) 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) d. Calculator (Trigonometry) Demonstrate the
packets captured traces using Wireshark Packet Analyzer Tool for peer to peer mode
PREREQUISITES:
COURSE OBJECTIVES:
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
COURSE OUTCOMES:
THEORY:
A socket is the mechanism that most popular operating systems provide to give programs access
to the network. It allows messages to be sent and received between applications (unrelated
processes) on different networked machines.
Mathematical Model:
S: {I, O, F, DD, NDD, shared memory}
No shared memory
FAQS:
1. What are the steps involved in creating & using sockets for TCP connection?
Group A
Assignment: 6
COURSE OBJECTIVES: To understand and implement file transfer using UDP protocol
COURSE OUTCOMES:
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY
Mathematical Model
No shared memory
I= {Data/msg }
CONCLUSION:
FAQ’s
Ans: Multimedia applications ,DNS,DHCP prefer UDP. Timely delivery is the major
constraint of these applications
Group A
Assignment No. : 7
AIM : Packet Analyzer
COURSE OBJECTIVES: Configure the computing node with understanding of protocols and
technologies
COURSE OUTCOMES:
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY
1. TCP:
The Transmission Control Protocol (TCP) is one of the core protocols of the Internet
protocol suite (IP), and is so common that the entire suite is often called TCP/IP. TCP
provides reliable, ordered and error-checked delivery (or notification of failure to deliver) of
a stream of octets between programs running on computers connected to a local area
network, intranet or the public Internet. It resides at the transport
2. UDP:
The User Datagram Protocol (UDP) is one of the core members of the Internet protocol
Suite. UDP uses a simple connectionless transmission model with a minimum of protocol
mechanism. It has no handshaking dialogues, and thus exposes any unreliability of the
underlying network protocol to the user's program. There is no guarantee of delivery,
ordering, or duplicate protection
3.ICMP:
4.IGMP:
Mathematical Model
No shared memory
CONCLUSION:
Outcome of the experiment is students are able to
analyze formats captured through Wireshark for wired network. 1. Ethernet 2. IP 3.TCP 4. UDP
Group:A
ASSIGNMENT NO.8
TITLE : Write a program to simulate Go back N and Selective Repeat Modes of Sliding Window
Protocol
COURSE OUTCOMES
THEORY
The most important functions of Data Link layer to satisfy the above requirements are error
control and flow control.
Flow Control is a technique so that transmitter and receiver with different speed characteristics
can communicate with each other. Flow control ensures that a transmitting station, such as a
server with higher processing capability, does not overwhelm a receiving station, such as a
desktop system, with lesser processing capability. This is where there is an orderly flow of
transmitted data between the source and the destination.
Error Control involves both error detection and error correction. It is necessary because errors
are inevitable in data communication, in spite of the use of better equipment and reliable
transmission media based on the current technology
There are two methods developed for flow control namely Stop-and-wait and Sliding-window.
Go-back-N ARQ: 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. Hence, the name of the protocol is go-back-N
ARQ. If a frame is lost, the receiver sends NAK after receiving the next frame.
In case there is long delay before sending the NAK, the sender will resend the lost frame after its
timer times out. If the ACK frame sent by the receiver is lost, the sender resends the frames after
its timer times out. Assuming full-duplex transmission, the receiving end sends piggybacked
acknowledgement by using some number in the ACK field of its data frame.
Let us assume that a 3-bit sequence number is used and suppose that a station sends frame 0 and
gets back an RR1, and then sends frames 1, 2, 3, 4, 5, 6, 7, 0 and gets another RR1.This might
either mean that RR1 is a cumulative ACK or all 8 frames were damaged. This ambiguity can be
overcome if the maximum window size is limited to 7, i.e. for a k-bit sequence number field it is
limited to 2k-1. The number N (=2k-1) specifies how many frames can be sent without receiving
acknowledgement.
Selective-Repeat ARQ
The selective-repetitive ARQ scheme retransmits only those for which NAKs are received or for
which timer has expired, this is shown in the Fig.3.3.12. 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 postNAK frames and processing power to
reinsert frames in proper sequence.
CONCLUSION:
The outcome of the assignment is the ability to implement go back N and selective repeat
FAQs:
1. What is ARQ
Ans: A sliding window protocol is a feature of packet-based data transmission protocols. Sliding
window protocols are used where reliable in-order delivery of packets is required, such as in the
Data Link Layer (OSI model) as well as in the Transmission ControlProtocol (TCP).
Ans: A stop-and-wait ARQ sender sends one frame at a time; it is a special case of the
general sliding window protocol with transmit and receive window sizes equal to one
Go Back N ARQ is less complicated than Selective Selective Repeat ARQ is complicated
repeat ARQ.
Go Back N ARQ Sender Window Size is 2^ (m)-1 .in Sender and receiver Window Size is 2^ (m-1
and receiver window size is 1.
Group B
Assignment No: 9
COURSE OBJECTIVES: To configure the DHCP server and remotely install software
COURSE OUTCOMES:
CO1 : Demonstrate LAN and WAN protocol behavior using Modern Tools
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY:
Dynamic Host Configuration Protocol (DHCP) The Dynamic Host Configuration Protocol
(DHCP) is a network service that enables host computers to be automatically assigned settings
from a server as opposed to manually configuring each network host. Computers configured to
be DHCP clients have no control over the settings they receive from the DHCP server, and the
configuration is transparent to the computer's user.
The most common settings provided by a DHCP server to DHCP clients include:
The advantage of using DHCP is that changes to the network, for example a change in the
address of the DNS server, need only be changed at the DHCP server, and all network hosts will
be reconfigured the next time their DHCP clients poll the DHCP server. As an added advantage,
it is also easier to integrate new computers into the network, as there is no need to check for the
availability of an IP address. Conflicts in IP address allocation are also reduced.
A DHCP server can provide configuration settings using the following methods:
This method entails using DHCP to identify the unique hardware address of each network card
connected to the network and then continually supplying a constant configuration each time the
DHCP client makes a request to the DHCP server using that network device. This ensures that a
particular address is assigned automatically to that network card, based on it's MAC address.
In this method, the DHCP server will assign an IP address from a pool of addresses (sometimes
also called a range or scope) for a period of time or lease, that is configured on the server or
until the client informs the server that it doesn't need the address anymore. This way, the clients
will be receiving their configuration properties dynamically and on a "first come, first served"
basis.
Automatic allocation
Using this method, the DHCP automatically assigns an IP address permanently to a device,
selecting it from a pool of available addresses. Usually DHCP is used to assign a temporary
address to a client, but a DHCP server can allow an infinite lease time.
Configuration
If you have two network cards in your ubuntu server you need to select which interface
you want to use for DHCP server listening.By default it listens to eth0.
sudo vi /etc/default/dhcp3-server
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.150 192.168.1.200;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example"; }
This will result in the DHCP server giving clients an IP address from the range
192.168.1.150- 192.168.1.200.
It will lease an IP address for 600 seconds if the client doesn't ask for a specific time
frame. Otherwise the maximum (allowed) lease will be 7200 seconds.
The server will also "advise" the client to use 192.168.1.254 as the default-gateway and
192.168.1.1 and 192.168.1.2 as its DNS servers.
After changing the config file you have to restart the dhcpd:
CONCLUSION:
FAQ’s
What is Bootp? What are its drawbacks.
Ans: To automatically assign an IP address to network devices from a configuration
server.Drawback: needs manual configuration by administrator
3. What messages are exchanged between a DHCP client and a DHCP server before the client
receives an IP address
Ans: DHCP scopes are used to define ranges of addresses from which a DHCP server can assign
IP addresses to clients.
Group:B
Assignment No.10
AIM : Implement a TCP socket program using Java
COURSE OUTCOME:
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY :
Sockets provide the communication mechanism between two computers using TCP. A client
program creates a socket on its end of the communication and attempts to connect that socket to
a server.
When the connection is made, the server creates a socket object on its end of the communication
The client and the server can now communicate by writing to and reading from the socket.
The java.net.Socket class represents a socket, and the java.net.ServerSocket class provides a
mechanism for the server program to listen for clients and establish connections with them
The following steps occur when establishing a TCP connection between two computers using
sockets
The server instantiates a ServerSocket object, denoting which port number communication is to
occur on
The server invokes the accept() method of the ServerSocket class. This method waits until a
client connects to the server on the given port
After the server is waiting, a client instantiates a Socket object, specifying the server name
and the port number to connect to
The constructor of the Socket class attempts to connect the client to the specified server and
the port number. If communication is established, the client now has a Socket object capable
of communicating with the server
On the server side, the accept() method returns a reference to a new socket on the server
After the connections are established, communication can occur using I/O streams. Each socket
has both an OutputStream and an InputStream. The client's OutputStream is connected to the
server's InputStream, and the client's InputStream is connected to the server's OutputStream
TCP is a two-way communication protocol, hence data can be sent across both streams at the
same time. Following are the useful classes providing complete set of methods to implement
sockets
Important methods
Method Description
1)public InputStream getInputStream() returns the InputStream attached with this socket.
2)public OutputStream getOutputStream() returns the OutputStream attached with this socket.
If you are programming a client, then you would open a socket like this
Socket MyClient;
MyClient = new Socket("Machine name", PortNumber);
Where Machine name is the machine you are trying to open a connection to, and PortNumber is
the port (a number) on which the server you are trying to connect to is running
If you are programming a server, then this is how you open a socket
ServerSocket MyService;
try {
MyServerice = new ServerSocket(PortNumber);
}
catch (IOException e) {
System.out.println(e);
}
When implementing a server you also need to create a socket object from theServerSocket in
order to listen for and accept connections from clients.
You should always close the output and input stream before you close the socket.
try {
output.close();
input.close();
MyClient.close();
}
catch (IOException e) {
System.out.println(e);
}
On the server side:
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
try {
output.close();
input.close();
serviceSocket.close();
MyService.close();
}
catch (IOException e) {
System.out.println(e);
}
CONCLUSION:
Outcome of the experiment is students are able to implement TCP socket in Java
FAQ’s
Group: B
Assignment No.11
AIM :Write a program using UDP sockets for wired network in Java
COURSE OUTCOMES:
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY :
UDP
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
Unreliable, packet-switched, packet data, no connection overhead, application-level protocols
exchange information immediately, two-way communication.
Communication model (UDP):
1. Java DatagramSocket class
Java DatagramSocket class represents a connection-less socket for sending and receiving
datagram packets. A datagram is basically an information but there is no guarantee of its content,
arrival or arrival time.
Commonly used Constructors of DatagramSocket class
a. DatagramSocket() throws SocketException:
It creates a datagram socket and binds it with the available Port Number on the localhost
machine.
b. DatagramSocket(int port) throws SocketException:
It creates a datagram socket and binds it with the given Port Number.
c. DatagramSocket(int port, InetAddress address) throws SocketEeption:
It creates a datagram socket and binds it with the specified port number and host address.
2. Java DatagramPacket class
Java DatagramPacket is a message that can be sent or received. If you send multiple packet, it
may arrive in any order. Additionally, packet delivery is not guaranteed.
Commonly used Constructors of DatagramPacket class
1. DatagramPacket(byte[] barr, int length):
It creates a datagram packet. This constructor is used to receive the packets.
2. DatagramPacket(byte[] barr, int length, InetAddress address, int port):
It creates a datagram packet. This constructor is used to send the packets.
1. Sending Data via a DatagramSocket
To send data via Java's DatagramSocket you must first create a DatagramPacket.
byte[] buffer = new byte[65508];
InetAddress address = InetAddress.getByName("jenkov.com");
DatagramPacket packet = new DatagramPacket(buffer, buffer.length, address, 9000);
The byte buffer (the byte array) is the data that is to be sent in the UDP datagram. The length of
the above buffer, 65508 bytes, is the maximum amount of data you can send in a single UDP
Group:B
Assignment No.12
AIM : Implement a routing algorithm using given topology in NS2
COURSE OUTCOMES:
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY:
What is NS2?
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
● ns-2 stands for Network Simulator version 2.
● ns-2: is a discrete event simulator for networking research
● Work at packet level.
● Provide substantial support to simulate bunch of protocols like TCP, UDP, FTP, HTTP
and DSR.
● Simulate wired and wireless network.
● Is primarily Unix based.
● Use TCL as its scripting language.
● ns-2 is a standard experiment environment in research community.
● otcl: Object-oriented support
● tclcl: C++ and otcl linkage
Why two language? (Tcl & C++)
● C++: Detailed protocol simulations require systems programming language (byte
manipulation, packet processing, algorithm implementation)
● – Run time speed is important
● – Turn around time (run simulation, find bug, fix bug,recompile, re-run) is slower
● Tcl: Simulation of slightly varying parameters or configurations
● – quickly exploring a number of scenarios
● – iteration time (change the model and re -run) is more important
ns-2 Directory Structure
Installation
● Get ns-2.29 all-in-one package from ns site. Get MannaSim Framework ns-2.29 patch.
http://www.mannasim.dcc.ufmg.br/download.htm
● Type the following command on the ns-allinone-2.29 folder:
patch -p1 < file_name.diff
● Install ns-2.29 as usual typing ns-allinone-2.29 folder:
./install
FAQ’s:
1. What is simulation. list some simulation softwares.
Ans:Simulation software is based on the process of modeling a real phenomenon with a
set of mathematical formulas .NS-2,NS-3,Opnet,neqsim etc
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
Group:B
Assignment:13
COURSE OUTCOMES :
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY :
Packet Tracer (PT) is a powerful and dynamic tool that displays the various protocols used in
networking, in either Real Time or Simulation mode. This includes layer 2 protocols such as
Ethernet and PPP, layer 3 protocols such as IP, ICMP, and ARP, and layer 4 protocols such as
TCP and UDP. Routing protocols can also be traced.
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
Now, as we can see, interfaces are up but the communication is not enabled because we have not
applied the protocol yet.
FAQ’s
1. What is packet tracer. What is its role.
2. what are the functionalities of a router
3. Briefly explain a. Switch b. Hub
4. what is the role of bridge in networking.
5. what are the types of media. briefly explain.
6. compare cat5,cat6,cat7
Group: B
COURSE OUTCOMES:
CO2 : Analyze data flow between peer to peer in an IP network using Application, Transport and
Network Layer Protocols
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY:
In a clear and simple way, this Cisco graphic shows the relationship of the parties in a DDOS
attack.One common method of attack involves saturating the target machine with external
communications requests, so much so that it cannot respond to legitimate traffic or responds so
slowly as to be rendered essentially unavailable. Such attacks usually lead to a server overload.In
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
general terms, DoS attacks are implemented by either forcing the targeted computer(s) to reset,
or consuming its resources so that it can no longer provide its intended service or obstructing the
communication media between the intended users and the victim so that they can no longer
communicate adequately.
Denial-of- service attacks can also lead to problems in the network 'branches' around
the actual computer being attacked.
Methods of Attack
Internet Control Message Protocol (ICMP) flood a smurf attack is one particular variant of a
flooding DoS attack on the public Internet. It relies on misconfigured network devices that allow
packets to be sent to all computer hosts on a particular network via the broadcast address of the
network, rather than a specific machine. The network then serves as a smurf amplifier. In such an
attack, the perpetrators will send large numbers of IP packets with the source address faked to
appear to be the address of the victim. The networks bandwidth is quickly used up, preventing
legitimate packets from getting through to their destinationPing flood is based on sending the
victim an overwhelming number of ping packets, usually using the ping command from Unix-
like hosts (the -t flag on Windows systems is much less capable of overwhelming a target, also
the -l (size) flag does not allow sent packet size greater than 65500 in Windows). It is very
simple to launch, the primary requirement being access to greater bandwidth than the victim.
Ping of death is based on sending the victim a malformed ping packet, which might lead to a
system crash.
(S)SYN flood
Teardrop attacks
A teardrop attack involves sending mangled IP fragments with overlapping, over-sized payloads
to the target machine. This can crash various operating systems because of a bug in their TCP/IP
fragmentation re-assembly code. Windows 3.1x,Windows 95 and Windows NT operating
systems, as well as versions of Linux prior to versions 2.0.32 and 2.1.63 are vulnerable to this
attack.
Around September 2009, a vulnerability in Windows Vista was referred to as a;teardrop attack,
but the attack targeted SMB2 which is a higher layer than the TCP packets that teardrop used.
Internet Control Message Protocol (ICMP) flood
This DOS attack could be carried out even through the command line, in the following manner:
The following Ping command creates a giant packet size 65500 for Ping. It might hang the
victims computer:
Continues ping
Group: B
Assignment No.15
AIM: VLAB Assignment Demonstration
PROBLEM STATEMENT: To learn the wireless communication between the sensor nodes.
Department of Computer Engineering, MMCOE
CN Lab Manual TE COMP, Sem-I, 2017-18
CO4: Develop Client-Server architectures and prototypes by the means of correct standards and
technology.
THEORY:
Virtual Labs is a project initiated by the Ministry of Human Resource Development,
Government of India, under the National Mission on Education through Information and
Communication Technology.[1] The project aims to provide remote-access to Laboratories in
various disciplines of science and engineering for students at all levels from under-graduate to
research
Motes)
7) Click the "Connect to WSN" button. (This is for connecting the WSN. This will initiate the
9) Watch the video for seeing the working of motes according to the given parameters.
The steps included in running the regular Send and Receive experiment in remote panel
CONCLUSION: