Sunteți pe pagina 1din 62

Exercise No.

: 1

NETWORK DEVICES

Date: 09-01-2015
Aim:
To study about Network Devices, Topologies and basic Linux Networking
Commands.

Hub
A Hub is the simplest of these devices. In general, a hub is the central part of
a wheel where the spokes come together. Hubs cannot filter data so data
packets are sent to all connected devices/computers and do not have
intelligence to find out best path for data packets. This leads to inefficiencies
and wastage.
As a network product, a hub may include a group of modem cards for dial-in
users, a gateway card for connections to a local area network (for example,
an Ethernet or a token ring), and a connection to a line. Hubs are used on
small networks where data transmission is not very high Bridge

In telecommunication networks, a bridge is a product that connects a local


area network (LAN) to another local area network that uses the same
protocol. Having a single incoming and outgoing port and filters traffic on
the LAN by looking at the MAC address, bridge is more complex than hub.
Bridge looks at the destination of the packet before forwarding unlike a hub.
It restricts transmission on other LAN segment if destination is not found. A
bridge works at the data-link (physical network) level of a network, copying
a data frame from one network to the next network along the communications
path.

Switch
A switch when compared to bridge has multiple ports. Switches can perform
error checking before forwarding data, which are very efficient by not
forwarding packets that error-end out or forwarding good packets selectively

to correct devices only switches can support both layer 2 (based on MAC
Address) and layer 3 (Based on IP address) depending on the type of switch.
Usually computers within the same subnet. large networks use switches
instead of hubs to connect

Router
A router, like a switch forwards packets based on address. Usually, routers
use the IP address to forward packets, which allows the network to go across
different protocols. Routers forward packets based on software while a
switch (Layer 3 for example) forwards using hardware called ASIC
(Application Specific Integrated Circuits). Routers support different WAN
technologies but switches do not.
Besides, wireless routers have access point built in. The most common home
use for routers is to share a broadband internet connection. As the router has
a public IP address which is shared with the network, when data comes
through the router, it is forwarded to the correct computer.

FIBER CABLE

Network topologies

Bus topology
In local area networks where bus topology is used, each node is connected to
a single cable. Each computer or server is connected to the single bus cable.
A signal from the source travels in both directions to all machines connected
on the bus cable until it finds the intended recipient. If the machine address
does not match the intended address for the data, the machine ignores the
data. Because the bus topology consists of only one wire, it is rather
inexpensive to implement when compared to other topologies. However, the
low cost of implementing the technology is offset by the high cost of

managing the network. Additionally, because only one cable is utilized, it can
be the single point of failure.
Linear bus
The type of network topology in which all of the nodes of the network are
connected to a common transmission medium which has exactly two
endpoints (this is the 'bus', which is also commonly referred to as
the backbone, or trunk) all data that is transmitted between nodes in the
network is transmitted over this common transmission medium and is able to
be received by all nodes in the network simultaneously

When the electrical signal reaches the end of the bus, the signal "echoes"
back down the line, causing unwanted interference. As a solution, the two
endpoints of the bus are normally terminated with a device called a
terminator that prevents this echo.
Star topology
In local area networks with a star topology, each network host is connected to
a central hub with a point-to-point connection. In Star topology every node
(computer workstation or any other peripheral) is connected to a central node
called hub or switch. The switch is the server and the peripherals are the
clients. The network does not necessarily have to resemble a star to be
classified as a star network, but all of the nodes on the network must be
connected to one central device. All traffic that traverses the network passes
through the central hub. The hub acts as a signal repeater. The star topology
is considered the easiest topology to design and implement. An advantage of
the star topology is the simplicity of adding additional nodes. The primary
disadvantage of the star topology is that the hub represents a single point of
failure.
Ring Topology
A network topology that is set up in a circular fashion in which data travels
around the ring in one direction and each device on the ring acts as a repeater
to keep the signal strong as it travels. Each device incorporates a receiver for
the incoming signal and a transmitter to send the data on to the next device in

the ring. The network is dependent on the ability of the signal to travel
around the ring. When a device sends data, it must travel through each device
on the ring until it reaches its destination. Every node is a critical link. In a
ring topology, there is no server computer present; all nodes work as a server
and repeat the signal. The disadvantage of this topology is that if one node
stops working, the entire network is affected or stops working.
Mesh topology
In a mesh topology (i.e., a partially connected mesh topology), there are at
least two nodes with two or more paths between them to provide redundant
paths to be used in case the link providing one of the paths fails. This
decentralization is often used to compensate for the single-point-failure
disadvantage that is present when using a single device as a central node
(e.g., in star and tree networks)
Fully connected network
A fully connected network is a communication network in which each of
the nodes is connected to each other. In graph theory it known as a complete
graph. A fully connected network doesn't need to use switching or
broadcasting. However, its major disadvantage is that the number of
connections grows quadratically with the number of nodes, as per the formula

and hence, it is extremely impractical for large networks. A two-node


network is technically a fully connected network.
Partially connected
The type of network topology in which some of the nodes of the network are
connected to more than one other node in the network with a point-to-point
link this makes it possible to take advantage of some of the redundancy that
is provided by a physical fully connected mesh topology without the expense
and complexity required for a connection between every node in the network.

Tree Topology
A tree topology is essentially a combination of bus topology and star
topology. The nodes of bus topology are replaced with standalone star
topology networks. This results in both disadvantages of bus topology and
advantages of star topology.
For example, if the connection between two groups of networks is broken
down due to breaking of the connection on the central linear core, then those
two groups cannot communicate, much like nodes of a bus topology.
However, the star topology nodes will effectively communicate with each
other.
It has a root node, intermediate nodes, and ultimate nodes. This structure is
arranged in a hierarchical form and any intermediate node can have any
number of the child nodes.

Client server architecture.


Client-server architecture (client/server) is a network architecture in which each computer or
process on the network is either a clientor a server. Servers are powerful computers or
processesdedicated to

managing disk

drives (file

servers), printers (print

servers),

or

network traffic (network servers ). Clients are PCs orworkstations on which users run applications.
Clients rely on servers for resources, such as files, devices, and even processing power.
Another type of network architecture is known as a peer-to-peerarchitecture because each node has
equivalent responsibilities. Both client/server and peer-to-peer architecturesare widely used, and
each has unique advantages and disadvantages.
Client-server architectures are sometimes called two-tier architectures.
PROXY SERVER
In computer networks, a proxy server is a server (a computer system or an application) that acts as
an intermediary for requests from clients seeking resources from other servers. A client connects to
the proxy server, requesting some service, such as a file, connection, web page, or other resource
available from a different server and the proxy server evaluates the request as a way to simplify
and control its complexity. Proxies were invented to add structure and encapsulation to distributed
systems. Today, most proxies are web proxies, facilitating access to content on the World Wide
Web and providing anonymity.
GATEWAY AND DFIREWALL.
A gateway is simply a device that joins together two different networks. In the most common
scenario, an internal network with the internet. A router is an example of a gateway device. A
router is a device that does routing, deciding where packets are sent to based on its IP address.
A firewall is a filter that examines packets against a set of defined rules in order to decide whether
to allow the packets through.
In many devices, the functionality of both a gateway and a firewall is present. Of course, there are
dedicated versions of each for use in large enterprise networks.

WIRELESS NETWORKS
Wireless LAN.
A wireless LAN (or WLAN, for wireless local area network, sometimes
referred to as LAWN, for local area wireless network) is one in which a
mobile user can connect to a local area network (LAN) through a
wireless (radio) connection. The IEEE 802.11 group of standards specify the
technologies for wireless LANs. 802.11 standards use the Ethernet protocol
and CSMA/CA (carrier sense multiple access with collision avoidance) for
path sharing and include an encryption method, the Wired Equivalent Privacy
algorithm.

SATELLITE NETWORKS.
Satellite Internet access is Internet access provided through
communications satellites. Modern satellite Internet service is typically
provided to users through geostationary satellites that can offer high data
speeds, with newer satellites using Ka band to achieve downstream data
speeds up to 50 Mbps.

SOFTWARE DEFINED NETWORKS.


The physical separation of the network control plane from the forwarding
plane, and where a control plane controls several devices.
Software-Defined Networking (SDN) is an emerging architecture that is
dynamic, manageable, cost-effective, and adaptable, making it ideal for the

high-bandwidth, dynamic nature of today's applications. This architecture


decouples the network control and forwarding functions enabling the network
control to become directly programmable and the underlying infrastructure to
be abstracted for applications and network services. The OpenFlow
protocol is a foundational element for building SDN solutions. The SDN
architecture is:

Directly programmable: Network control is directly programmable


because it is decoupled from forwarding functions.
Agile: Abstracting control from forwarding lets administrators
dynamically adjust network-wide traffic flow to meet changing needs.
Centrally managed: Network intelligence is (logically) centralized in
software-based SDN controllers that maintain a global view of the
network, which appears to applications and policy engines as a single,
logical switch.
Programmatically configured: SDN lets network managers
configure, manage, secure, and optimize network resources very
quickly via dynamic, automated SDN programs, which they can write
themselves because the programs do not depend on proprietary
software.
Open standards-based and vendor-neutral: When implemented
through open standards, SDN simplifies network design and operation
because instructions are provided by SDN controllers instead of
multiple, vendor-specific devices and protocols.

SDN ARCHITERCTURE.

WIRELESS SENSOR NETWORKS.


A wireless sensor network (WSN) (sometimes called a wireless sensor and
actor network (WSAN) are spatially
distributed autonomous sensors to monitor physical or environmental
conditions, such as temperature, sound, pressure, etc. and to cooperatively
pass their data through the network to a main location. The more modern
networks are bi-directional, also enabling control of sensor activity. The
development of wireless sensor networks was motivated by military
applications such as battlefield surveillance; today such networks are used in
many industrial and consumer applications, such as industrial process
monitoring and control, machine health monitoring, and so on.
The WSN is built of "nodes" from a few to several hundreds or even
thousands, where each node is connected to one (or sometimes several)
sensors. Each such sensor network node has typically several parts:
a radio transceiver with an internal antenna or connection to an external
antenna, a microcontroller, an electronic circuit for interfacing with the
sensors and an energy source, usually a battery or an embedded form
of energy harvesting. A sensor node might vary in size from that of a

shoebox down to the size of a grain of dust, although functioning "motes" of


genuine microscopic dimensions have yet to be created.

DATA CENTER NETWORKS.


Data center is a pool of resources (computational, storage, network)
interconnected using a communication network. Data Center Network (DCN)
holds a pivotal role in a data center, as it interconnects all of the data center
resources together. DCNs need to be scalable and efficient to connect tens or
even hundreds of thousands of servers to handle the growing demands
of Cloud computing. Todays data centers are constrained by the
interconnection network.

Linux Basic networking commands


vi is the standard Unix text editing program
To open the file /etc/lilo.conf:
:e /etc/lilo.conf
if you want to save the current buffer to the file randomness, you would type:
:w

randomness

to quit vi is through :wq


Ping
Ping the host google.com to see if it is alive.
ping google.com -c 1
Ping the host google.com once. Output will resemble the following:
PING google.com (204.228.150.3) 56(84) bytes of
data.
64 bytes from www.google.com (204.228.150.3):
icmp_seq=1 ttl=63 time=0.267 ms
--- google.com ping statistics --1 packets transmitted, 1 received, 0% packet loss,
time 0ms
rtt min/avg/max/mdev = 0.267/0.267/0.267/0.000 ms
You can also use IP address
%

ping 204.228.150.3 c Count

Stop after sending count ECHO_REQUEST packets. With


the deadline option, ping waits for count ECHO_REPLY packets, until
the timeout expires.

$netstat a
To know the active internet connections (Servers and established)

$ netstat -a
Active Internet connections (servers and
established)
Proto Recv-Q Send-Q Local Address
Address
State

Foreign

tcp
LISTEN

0 enlightened:domain

*:*

tcp
LISTEN

0 localhost:ipp

*:*

tcp
0
0 enlightened.local:54750 li2405.members.li:http ESTABLISHED
tcp
0
0 enlightened.local:49980
del01s07-in-f14.1:https ESTABLISHED
tcp6
LISTEN

0 ip6-localhost:ipp

[::]:*

udp

0 enlightened:domain

*:*

udp

0 *:bootpc

*:*

udp

0 enlightened.local:ntp

*:*

udp

0 localhost:ntp

*:*

udp

0 *:ntp

*:*

udp

0 *:58570

*:*

udp

0 *:mdns

*:*

udp

0 *:49459

*:*

udp6

0 fe80::216:36ff:fef8:ntp [::]:*

udp6

0 ip6-localhost:ntp

[::]:*

udp6

0 [::]:ntp

[::]:*

udp6

0 [::]:mdns

[::]:*

udp6

0 [::]:63811

[::]:*

udp6

0 [::]:54952

[::]:*

Active UNIX domain sockets (servers and


established)
Proto RefCnt Flags
I-Node
Path

Type

State

unix 2
12403

[ ACC ]
STREAM
@/tmp/dbus-IDgfj3UGXX

LISTENING

unix 2
40202

[ ACC ]
STREAM
LISTENING
@/dbus-vfs-daemon/socket-6nUC6CCx

ifconfig
stands for "interface configuration". It is used to view and change the
configuration of the network interfaces on your system.
Running the ifconfig command with no arguments, like this:
ifconfig
will display information about all network interfaces currently in operation.
The output will resemble the following:

eth0
Link encap:Ethernet
09:00:12:90:e3:e5

HWaddr

inet addr:192.168.1.29
Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe70:e3f5/64
Scope:Link
UP BROADCAST RUNNING MULTICAST

MTU:1500

Metric:1
RX packets:54071 errors:1 dropped:0
overruns:0 frame:0
TX packets:48515 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22009423 (20.9 MiB)
bytes:25690847 (24.5 MiB)

TX

Interrupt:10 Base address:0xd020

lo

Link encap:Local Loopback


inet addr:127.0.0.1

Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host


UP LOOPBACK RUNNING

MTU:16436

Metric:1

RX packets:83 errors:0 dropped:0


overruns:0 frame:0
TX packets:83 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:0

RX bytes:7766 (7.5 KiB)

TX bytes:7766

(7.5 KiB)

wlan0
Link encap:Ethernet
58:a2:c2:93:27:36

HWaddr

inet addr:192.168.1.64
Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::6aa3:c4ff:fe93:4746/64
Scope:Link
UP BROADCAST RUNNING MULTICAST

MTU:1500

Metric:1
RX packets:436968 errors:0 dropped:0
overruns:0 frame:0
TX packets:364103 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:115886055 (110.5 MiB)
bytes:83286188 (79.4 MiB)

TX

traceroute
Slackware's traceroute(8) command is a very useful network diagnostic
tool. traceroute displays each host that a packet travels through as it tries to
reach its destination. You can see how many hops from the Slackware web
site you are with this command:
% traceroute www.slackware.com
Each host will be displayed, along with the response times at each host. Here
is an example output:

% traceroute www.slackware.com
traceroute to www.slackware.com (204.216.27.13), 30
hops max, 40 byte packets
1 zuul.tdn (192.168.1.1)
0.303 ms

0.409 ms

2 207.171.227.254 (207.171.227.254)
32.873 ms 32.433 ms

1.032 ms

18.218 ms

3 border-sf-2-0-4.sirius.com (205.134.230.254)
15.662 ms 15.731 ms 16.142 ms
4 pb-nap.crl.net (198.32.128.20)
23.672 ms 21.378 ms

20.741 ms

5 E0-CRL-SFO-03-E0X0.US.CRL.NET (165.113.55.3)
22.293 ms 21.532 ms 21.29 ms
6 T1-CDROM-00-EX.US.CRL.NET (165.113.118.2)
24.544 ms 42.955 ms 58.443 ms
7 www.slackware.com (204.216.27.13)
53.033 ms 48.328 ms

38.115 ms

DNS Tools
host is used to map names to IP addresses. It is a very quick and simple
utility without a lot of functions.
% host www.slackware.com
www.slackware.com is an alias for slackware.com.
slackware.com has address 64.57.102.34
But let's say for some reason we want to map an IP address to a domain
name; what then?

Nslookup
% nslookup 64.57.102.34
Note: nslookup is deprecated and may be removed
from future releases.
Consider using the `dig' or `host' programs
instead. Run nslookup with
the `-sil[ent]' option to prevent this message from
appearing.
Server:

192.168.1.254

Address:

192.168.1.254#53

Non-authoritative answer:
www.slackware.com
slackware.com.
Name:

canonical name =

slackware.com

Address: 64.57.102.34

telnet
The ability to remotely log in and do stuff on another computer is what
separates Unix and Unix-like operating systems from other operating
systems.
telnet allows you to log in to a computer, just as if you were sitting at the
terminal. Once your username and password are verified, you are given a
shell prompt. From here, you can do anything requiring a text console.
Compose email, read newsgroups, move files around, and so on. If you are

running X and you telnet to another machine, you can run X programs on the
remote computer and display them on yours.
To login to a remote machine, use this syntax:
% telnet <hostname>
If the host responds, you will receive a login prompt. Give it your username
and password. That's it. You are now at a shell. To quit your telnet session,
use either the exitcommand or the logout command.
telnet does not encrypt the information it sends. Everything is sent in
plain text, even passwords. It is not advisable to use telnet over the
Internet. Instead, consider the Secure Shell. It encrypts all traffic and is
available for free.
The other use of telnet
You can also use the telnet command to connect to a host on a certain port.
% telnet <hostname> [port]
This can be quite handy when you quickly need to test a certain service, and
you need full control over the commands, and you need to see what exactly is
going on. You can interactively test or use an SMTP server, a POP3 server,
an HTTP server, etc. this way.
Telnet on a webserver
% telnet store.slackware.com 80
Trying 69.50.233.153...
Connected to store.slackware.com.
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 200 OK
Date: Mon, 25 Apr 2005 20:47:01 GMT
Server: Apache/1.3.33 (Unix) mod_ssl/2.8.22
OpenSSL/0.9.7d
Last-Modified: Fri, 18 Apr 2003 10:58:54 GMT
ETag: "193424-c0-3e9fda6e"
Accept-Ranges: bytes
Content-Length: 192
Connection: close
Content-Type: text/html

Connection closed by foreign host.

The Secure shell


Today, secure shell basks in the adoration that telnet once enjoyed. ssh allows
one to make a connection to a remote machine and execute programs as if
one were physically present; however, ssh encrypts all the data travelling
between the two computers so even if others intercept the conversation, they
are unable to understand it. A typical secure shell connection follows.
% ssh carrier.lizella.net -l alan
The authenticity of host 'carrier.lizella.net
(192.168.1.253)' can't be
established.
RSA key fingerprint is
0b:e2:5d:43:4c:39:4f:8c:b9:85:db:b2:fa:25:e9:9d.

Are you sure you want to continue connecting


(yes/no)? yes
Warning: Permanently added 'carrier.lizella.net'
(RSA) to the list of
known hosts.
Password: password
Last login: Sat Nov
192.168.1.102

6 16:32:19 2004 from

Linux 2.4.26-smp.
alan@carrier:~$ ls -l MANIFEST
-rw-r--r-MANIFEST

1 alan users 23545276 2004-10-28 20:04

alan@carrier:~$ exit
logout
Connection to carrier.lizella.net closed.
ftp
To connect to an FTP server, simply run the ftp command and specify the
host:
% ftp <hostname> [port]

If the host is running an FTP server, it will ask for a username and password.
You can login as yourself or as anonymous. Anonymous FTP sites are very
popular for software archives. Once connected, you will be at
the ftp> prompt. There are special commands for FTP, but they are similar to
other standard commands. The following shows some of the basic commands
and what they do:

Command

Purpose

ls

List files

cd <dirname> Change directory


bin

Set binary transfer mode

ascii

Set ASCII transfer mode

get
<filename>

Download a file

put
<filename>

Upload a file

hash

Toggle hash mark stats indicator

tick

Toggle byte counter indicator

prom

Toggle interactive mode for downloads

mget <mask>

Download a file or group of files; wildcards are


allowed

mput <mask>

Upload a file or group of files; wildcards are


allowed

quit

Log off the FTP server

gzip
gzip is the GNU compression program. It takes a single file and compresses
it. The basic usage is as follows:
% gzip filename
The resulting file will be named filename.gz and will usually be smaller than
the input file. Note that filename.gz will replace filename. This means
that filename will no longer exist, even though a gzipped copy will.

Exercise No. : 2

IP ADDRESS

Date: 22-01-2015
Aim:
To know your IP address and check whether it is broadcasting or not.

Algorithm:

1. Start
2. Import necessary packages.
3. In main function try block
a) Create an object for BufferedReader Class using new
operator to read the input by user.
b) Get the input host name from user.
c) Get the ipaddress for it using InetAddress class.
d) Display the ipaddress.
e) Get the range of addresses assigned to host for different types
of networks using getAllByName method.
f) Check the host ipaddress falls within this range
If yes then display broadcasting address
Else display not broadcasting address.
4. Catch any exception in try block.
5. Stop.

Source Code:
import java.net.*;
public class ipaddress
{
public static void main(String args[])
{
try
{
BufferedReader br=new
BufferedReader(newInputStreamReader(System.in));
System.out.println("Enter the host name");
String host=br.readLine();
InetAddress address=InetAddress.getByName(host);
System.out.println(address);
InetAddress i1[]=InetAddress.getAllByName(host);
for(int j=0;j<i1.length;j++)
{
if(address.equals(i1[j]))
{
System.out.println("Address is
Broadcasting.");
}
}
}
catch(Exception e)
{
System.out.println("Address not Broadcasting");
}
}
}

Output:
Case-I:
Enter the host name:
Aditya-PC
Aditya-PC/192.168.75.1
Address is Broadcasting.

Case-II:
Enter the host name:
HCL-10
Address is not Broadcasting...

Result:
Hence, the program was executed successfully, and the IP address of the
system was displayed, specifying whether the particular address is
broadcasting or not.

Exercise No. : 3

DATE SERVER

Date: 29-01-2015
Aim:
To retrieve date from server.
Algorithm:
Server1. Start.
2. Import necessary packages.
3. In main function
a) Create a Server object and using it establish the connection to
the client.
b) Get the current date in Date object
c) Get the IP address of the Server machine.
d) Using PrintWriter object send the current date to client via
OutputStream.
e) Display the IPaddress.
f) Close the printwriter object connection.
4. Catch if any exception in the try block and display it.
5. Stop.
Client1. Start.
2. Import necessary packages.
3. In main function
a) Declare the necessary String variables
4. In try block
a) Set the variable host to Localhost using command line
arguments passing.
b) Create a Socket object.
c) Using DataInputStream object read the Date value supplied
by the Server
d) Display the date value.

5. Catch if any exception in try block and display it.


6. Finally close the socket.
7. Stop.
Source Code:
Serverimport java.util.*;
import java.net.*;
import java.io.*;
class Server
{
public static void main(String args[])
{
try
{
ServerSocket ss=new ServerSocket(2413);
Socket s=ss.accept();
Date d=new Date();
InetAddress ia=s.getInetAddress();
PrintStream ps=new PrintStream(s.getOutputStream());
ps.println(d);
System.out.println("The address is: "+ia);
ps.close();
ss.close();
}
catch(Exception e)
{
}
}
}

Clientimport java.io.*;
import java.net.*;
class Client
{
public static void main(String args[])throws IOException
{
String host,readdate;
try
{
if(args.length>0)
{
host=args[0];
}
else
{

host="localhost";
}
Socket s=new Socket(host,2413);
DataInputStream dis=new
DataInputStream(s.getInputStream());
readdate=dis.readLine();
System.out.println("The date is: "+readdate);
}
catch(Exception e)
{
}
}
}

Output:
Server ConsoleThe address is: /127.0.0.1

Client ConsoleThe date is: Sat Apr 04 16:40:46 IST 2015

Result:
Hence, date was retrieved from the server by the client successfully.

Exercise No. : 4

FILE AVAILABILITY IN SERVER

Date: 30-01-2015
Aim:
To check for the availability of a file in server.
Algorithm:
Server1. Start.
2. Import necessary packages.
3. In main function try block
a) Initialize a ServerSocket and Socket to null.
b) Create an object for ServerSocket and using it establish a
connection with TCP Server from Socket object.
c) Using PrintWriter object with getOutputStream method
enabled and bufferedReader object get the input FileName
from the client.
d) Create a FileOutputStream object for client file.
4. Stop.
Client1. Start.
2. Import necessary packages.
3. In main function try block
a) Create a Socket object.
b) Using BufferedReader object read the filename.
c) Creat a PrintWriter object to display the filename using
getOutputStream method set to true.
d) Check using File object if file exists in Server
i)
ii)

If yes then display file is available


Else display file is not available.

4. Catch if any exception in try block and display it.


5. Stop.

Source Code:
Serverimport java.net.*;
import java.io.*;
class Server
{
public static void main(String args[])
{
try
{
ServerSocket ss=new ServerSocket(2500);
Socket S=ss.accept();
System.out.println("Connection established...");
PrintWriter pw=new PrintWriter(S.getOutputStream(),true);
BufferedReader br=new BufferedReader(new
InputStreamReader(S.getInputStream()));
String fname=br.readLine();
FileOutputStream f1=new FileOutputStream(fname);
ss.close();
pw.close();
f1.close();
}
catch(Exception e)
{
}
}
}

Clientimport java.net.*;
import java.io.*;
class Client
{
public static void main(String args[])
{
try
{
Socket S =new Socket("localhost",2500);
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.print("Enter the Filename: ");
String fname=br.readLine();
PrintWriter pw=new PrintWriter(S.getOutputStream(),true);
pw.println(fname);
File f2=new File(fname);
if(f2.exists())
{
System.out.println("File is Available.");
}
else
{
System.out.println("File not available.");
}
S.close();
}

catch(Exception e)
{
}
}
}

Output:
Case-I: If the file t1.txt does not exist in the workspace,
Server ConsoleConnection established...

Client ConsoleEnter the Filename: t1.txt


File not Available.

Case-II: If the file t1.txt exists,


Server ConsoleConnection established...

Client ConsoleEnter the Filename: t1.txt


File is Available.

Result:
Hence, the required output was displayed whether the file exists in the
workspace or not.

Exercise No. : 5

BROADCASTING SERVER

Date: 05-02-2015
Aim:
To write a server program, which broadcasts Hello message to five clients.
Algorithm:
Server1. Start.
2. Import necessary packages.
3. In main function, Initialize 5 Sockets and 5 ServerSockets to null.
4. In try block
a)
b)
c)
d)

Establish the connection using ServerSockets.


Using BufferedReader Object read the server message
Display the Server message
Create a PrintWriter objects to send the message to all clients
using getOutputStream method.

5. Catch if any exception in try block and display it.


6. Finally close the Sockets.
7. Stop.
Client1. Start.
2. Import necessary packages.
3. In main function
Initialize a Socket to null.
4. try block
a) Create a Socket object with different portno(s) for each
client.
b) Using BufferedReader Object read the message from the
client.
5. Display the message

6. Catch if any exception in try block and display it.


7. Finally close the Socket.
8. Stop.
Source Code:
Serverimport java.net.*;
import java.io.*;
public class HelloServer
{
public static void main(String args[])throws IOException
{
Socket s1=null;
Socket s2=null;
Socket s3=null;
Socket s4=null;
Socket s5=null;
ServerSocket ss1=null;
ServerSocket ss2=null;
ServerSocket ss3=null;
ServerSocket ss4=null;
ServerSocket ss5=null;
try
{
ss1=new ServerSocket(8000);
ss2=new ServerSocket(8001);
ss3=new ServerSocket(8002);
ss4=new ServerSocket(8003);
ss5=new ServerSocket(8004);
s1=ss1.accept();
s2=ss2.accept();
s3=ss3.accept();
s4=ss4.accept();
s5=ss5.accept();
System.out.println("Connection Established");
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.print("Enter the message: ");
String fname=br.readLine();
System.out.println(fname);
PrintWriter pw=new PrintWriter(s1.getOutputStream(),true);
pw.println(fname);
PrintWriter pw1=new PrintWriter(s2.getOutputStream(),true);
pw1.println(fname);
PrintWriter pw2=new PrintWriter(s3.getOutputStream(),true);
pw2.println(fname);
PrintWriter pw3=new PrintWriter(s4.getOutputStream(),true);
pw3.println(fname);
PrintWriter pw4=new PrintWriter(s5.getOutputStream(),true);
pw4.println(fname);
}
catch(Exception e)
{
System.out.println(e);
}
finally

{
ss1.close();
ss2.close();
ss3.close();
ss4.close();
ss5.close();
s1.close();
s2.close();
s3.close();
s4.close();
s5.close();
}
}
}

Client 1import java.net.*;


import java.io.*;
class Client1
{
public static void main(String args[])throws IOException
{
Socket s=null;
try
{
s=new Socket("localhost",8000);
BufferedReader br=new BufferedReader(new
InputStreamReader(s.getInputStream()));
String msg=br.readLine();
System.out.println(msg);
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
}
}
}

Client 2import java.net.*;


import java.io.*;
class Client2
{
public static void main(String args[])throws IOException
{
Socket s=null;
try
{
s=new Socket("localhost",8001);

BufferedReader br=new BufferedReader(new


InputStreamReader(s.getInputStream()));
String msg=br.readLine();
System.out.println(msg);
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
}
}
}

Client 3import java.net.*;


import java.io.*;
class Client3
{
public static void main(String args[])throws IOException
{
Socket s=null;
try
{
s=new Socket("localhost",8002);
BufferedReader br=new BufferedReader(new
InputStreamReader(s.getInputStream()));
String msg=br.readLine();
System.out.println(msg);
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
}
}
}

Client 4import java.net.*;


import java.io.*;
class Client4
{
public static void main(String args[])throws IOException
{
Socket s=null;
try
{
s=new Socket("localhost",8003);

BufferedReader br=new BufferedReader(new


InputStreamReader(s.getInputStream()));
String msg=br.readLine();
System.out.println(msg);
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
}
}
}

Client 5import java.net.*;


import java.io.*;
class Client5
{
public static void main(String args[])throws IOException
{
Socket s=null;
try
{
s=new Socket("localhost",8004);
BufferedReader br=new BufferedReader(new
InputStreamReader(s.getInputStream()));
String msg=br.readLine();
System.out.println(msg);
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
}
}
}

Output:
Server ConsoleConnection Established
Enter the message: Hello
Hello

Client1 ConsoleHello

Client2 ConsoleHello

Client3 ConsoleHello

Client4 ConsoleHello

Client5 ConsoleHello

ResultHence, the message from the server was broadcasted to five clients.

Exercise No. : 6

SLIDING WINDOW PROTOCOL

Date: 12-02-2015
Aim:
To simulate sliding window protocol.
Algorithm:
Server1. Start.
2. Import necessary packages.
3. In main function
a) Create connection with cleint using ServerSocket.
b) Declare DataInputStream and DataOutputStream objects.
c) Use readUTF method to get the message from the client and
display it.
d) Use writeUTF method to send the same message back to the
client.
4. Stop.
Client1. Start.
2. Import necessary packages.
3. In main function
e) Create connection with server using ClientSocket.
f) Declare DataInputStream and DataOutputStream objects.
g) Declare one more DataInputStream object to get the input
from the client.
h) Using writeUTF method send to Server.
i) Using readUTF get the acknowledgement message from the
server.
j) If both sent and received matches then display the message
acknowledged.
4. Catch if any exception in try block and display it.
5. Stop.

Source Code:
Serverimport java.io.*;
import java.net.*;
class Server
{
public static void main(String args[])throws IOException
{
ServerSocket sr=new ServerSocket(3000);
System.out.println("Server is waiting");
Socket s=sr.accept();
System.out.println("Client request waiting");
DataInputStream din=new DataInputStream(s.getInputStream());
DataOutputStream dout=new DataOutputStream(s.getOutputStream());
while(true)
{
try
{
String data=din.readUTF();
System.out.println("Client message= "+data);
String d2=data;
dout.writeUTF(d2);
dout.flush();
sr.close();
}
catch(EOFException e)
{
}
}
}
}

Clientimport java.io.*;
import java.net.*;
class Client
{
public static void main(String args[])throws IOException
{
try
{
DataInputStream din=new DataInputStream(System.in);
Socket client=new Socket("localhost",3000);
DataInputStream sin=new
DataInputStream(client.getInputStream());
DataOutputStream dout=new
DataOutputStream(client.getOutputStream());
System.out.println("Enter your Message: ");
while(true)
{
String ss=din.readLine();
dout.writeUTF(ss);
String s1=sin.readUTF();
if(s1.equals(ss))
System.out.println("Message Acknowledged: "+s1);

client.close();
}
}
catch(Exception e)
{
}
}
}

Output:
Server ConsoleServer is waiting
Client request waiting
Client message= Hello

Client ConsoleEnter your Message:


Hello
Message Acknowledged: Hello

Result:
Hence, the sliding window protocol was illustrated successfully.

Exercise No. : 7

TCP SOCKET CONNECTION

Date: 19-02-2015
Aim:
To establish a TCP Socket connection between two systems and
communicate "Hello" message.
Algorithm:
Server1. Start.
2. Import necessary packages.
3. In main function
Initialize a Socket and ServerSocket to null.
4. In try block
e) Establish the connection using ServerSocket.
f) Using BufferedReader Object read the client message from
Client
g) Display the client message
5. Catch if any exception in try block and display it.
6. Finally close the Sockets.
7. Stop.

Client1. Start.
2. Import necessary packages.
3. In main function
Initialize a Socket to null.
4. try block
c) Create a Socket object.
d) Using BufferedReader Object read the message from the
client.
e) Display the message.

f) Create a PrintWriter object to send the message to the Server


using getOutputStream method.
5. Catch if any exception in try block and display it.
6. Finally close the Socket.
7. Stop.
Source Code:
Serverimport java.net. *;
import java.io.*;
class Server
{
public static void main(String args[])throws IOException
{
Socket s=null;
ServerSocket ss=null;
try
{
ss=new ServerSocket(8000);
s=ss.accept();
System.out.println("Connection Established!!");
BufferedReader br=new BufferedReader(new
InputStreamReader(s.getInputStream()));
String msg=br.readLine();
System.out.println(msg);
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
ss.close();
}
}
}

Clientimport java.net.*;
import java.io.*;
public class Client
{
public static void main(String args[])throws IOException
{
Socket s=null;
try
{
s=new Socket("Localhost",8000);
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));

System.out.println("Enter the message: ");


String msg=br.readLine();
System.out.println(msg);
PrintWriter pw=new PrintWriter(s.getOutputStream(),true);
pw.println(msg);
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
}
}
}

Output:
Server ConsoleConnection Established!!
Hello

Client ConsoleEnter the message:


Hello
Hello

Result:
Hence, the TCP connection between two systems was established, and the
message was communicated.

Exercise No. : 8

SIMPLE CHAT APPLICATION USING UDP

Date: 27-02-2015
Aim:
To develop a simple chat application for communicating between two
systems using DatagramSocket.
Algorithm:
Server1. Start.
2. Import necessary packages.
3. In Client Class declare the port numbers for both client and server and
a DatagramSocket variable and two byte buffer variable with predefined size.
4. In main function
a) Create a DatagramSocket objet using Serverport.
b) Create a DataInputStream Object.
c) While (true)
i)

ii)

Using it read the message from the Server and send


it to the client using send () method with necessary
arguments after converting it into bytes storing it in
buffer 1 by invoking a DatagramPack object
constructor.
Using DatatgramSocket object2 receive the
message from the client and convert it into bytes
storing it in Buffer2.

5. Stop.
Client1. Start.
2. Import necessary packages.
3. In Client Class declare the port numbers for both client and server and
a DatagramSocket variable and two byte buffer variable with predefined size.
4. In main function

d) Create a DatagramSocket objet using Clientport.


e) While (true)
iii)
iv)
v)

vi)

Create a DatagramPacket object using buffer1


varibale.
Invoke the receive method using socket on it and
display the message from the server.
Using DatatInputStream object get the message
from the client and convert it into bytes storing it in
Buffer2.
Send the client message to Server invoking send ()
method with necessary arguments.

5. Stop.
Source Code:
Serverimport java .io.*;
import java.net.*;
class Server
{
public static int serverport=3227,clientport=3444;
public static int buffer_size=1056;
public static DatagramSocket ds;
public static byte buff[]=new byte[buffer_size];
public static byte buff1[]=new byte[buffer_size];
public static void main(String a[])throws Exception
{
ds=new DatagramSocket(serverport);
DataInputStream dis=new DataInputStream(System.in);
while(true)
{
System.out.println("Enter the message:");
String str=dis.readLine();
buff=str.getBytes();
ds.send(new
DatagramPacket(buff,str.length(),InetAddress.getLocalHost(),clientport));
DatagramPacket p=new DatagramPacket(buff1,buff1.length);
ds.receive(p);
System.out.println("Message from client:");
System.out.println(new
String(p.getData(),0,p.getLength()));
}
}
}

Clientimport java.io.*;
import java.net.*;
class Client
{
public static int serverport=3227,clientport=3444;
public static int buffer_size=1056;
public static DatagramSocket ds;
public static byte buff[]=new byte[buffer_size];
public static byte buff1[]=new byte[buffer_size];
public static void main(String args[])throws Exception {
ds=new DatagramSocket(clientport);
while(true)
{
DatagramPacket p=new DatagramPacket(buff,buff.length);
ds.receive(p);
System.out.println("Message from server:");
System.out.println(new
String(p.getData(),0,p.getLength()));
System.out.println("Enter the message:");
DataInputStream dis=new DataInputStream(System.in);
String str=dis.readLine();
buff1=str.getBytes();
ds.send(new
DatagramPacket(buff1,str.length(),InetAddress.getLocalHost(),serverport));
}
}
}

Output:
Server ConsoleEnter the message:
Hello
Message from client:
Hi!
Enter the message:
Message Acknowledged.
Message from client:
Good Bye...
Enter the message:

Client ConsoleMessage from server:


Hello
Enter the message:
Hi!
Message from server:
Message Acknowledged.
Enter the message:
Good Bye...

Result:
Hence, a chat application was designed using UDP, for communication
between two systems.

Exercise No. : 9

DOWNLOAD A FILE FROM GIVEN SYSTEM USING TCP


SOCKETS

Date: 06-03-2015
Aim:
To design an FTP to download a given file from another system using TCP
Sockets.
Algorithm:
Server1. Start.
2. Import necessary packages.
3. In main function try block
e) Initialize a ServerSocket and socket to null to show that there
is no connection established yet.
f) Create an object for ServerSocket and using it establish a
connection with TCP Server from Socket object.
g) Using bufferedReader object get the input FileName and
display it.
h) Using again one more BufferedReader object and FileReader
class send the Server side program to PrintWriter Output
Stream to be received by the Client Side BufferedReader
Object br1.
4. Catch if any exception in try block and display it.
5. Finally close all the Sockets connection.
6. Stop.
Client1. Start.
2. Import necessary packages.
3. In main function
Initialize Socket variable s to null (meaning no connection established)
In try block,
a) Create a Socket object s and make connection.
b) Using BufferedReader object read the Filename.

c) Using PrintWriter object and again one more BufferedReader


Object (br2) display the File content in a while loop.
4. Catch if any exception in try block and display it.
5. Finally close the Socket.
6. Stop.
Source Code:
Serverimport java.net.*;
import java.io.*;
public class Server
{
public static void main(String args[])throws IOException
{
ServerSocket ss=null;
Socket s=null;
try
{
ss=new ServerSocket(2200);
s=ss.accept();
System.out.println("Connection established!");
BufferedReader br=new BufferedReader(new
InputStreamReader(s.getInputStream()));
String fname=br.readLine();
System.out.println("The filename is "+fname);
BufferedReader br1=new BufferedReader(new
FileReader(fname));
PrintWriter pw=new PrintWriter(s.getOutputStream(),true);
String fn=" ";
while((fn=br1.readLine())!=null)
{
pw.println(fn);
}
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
ss.close();
}
}
}

Clientimport java.net.*;
import java.io.*;
public class Client
{

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


{
Socket s=null;
try
{
s=new Socket("Localhost",2200);
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter the filename: ");
String fname=br.readLine();
PrintWriter pw=new PrintWriter(s.getOutputStream(),true);
pw.println(fname);
BufferedReader br1=new BufferedReader(new
InputStreamReader(s.getInputStream()));
String fn="";
while((fn=br1.readLine())!=null)
{
System.out.println(fn);
}
}
catch(Exception e)
{
System.out.println(e);
}
finally
{
s.close();
}
}
}

Output:
After creating a file named t1.txt in the workspace and adding some content
into it,
Server ConsoleConnection established!
The filename is t1.txt

Client ConsoleEnter the filename:


t1.txt
This is the content of the file...

Result:
Hence, the file was downloaded by the client using FTP, and its content was
displayed.

Exercise No. : 10

SHORTEST PATH ALGORITHM

Date: 20-03-2015
Aim:
To simulate shortest path algorithm in C language.
Algorithm:
1.
2.
3.
4.

Start.
Include necessary header files.
Declare necessary global variables.
In create_graph function
a) Obtain the no. of vertices and edges and initialize visited
node to 0 and distance between each edge as 32767(the
current minimum distance) (the largest positive value for the
integer datatype).
b) Get the distance between the edges connected.

5. In Algorithm implementation function


a) Get the source and destination vertices.
b) Initialize array variable source distance and source visited to
0 and the variable dc = d [source].
c) While source is not the destination
i)

If there is link between current node to its adjacent


nodes(direct neighbor) and

If they are not visited yet and


If initial set distance is greater than the distance from the source
set the latter as the minimum
else min = last minimum value
set.
Change the current node to the adjacent node one by one and set dc to
d[current] and
repeat the procedure until you
reach the destination.

6. Print the shortest distance between source to destination which is


finally available as d [dest].
(ie. current =destination)
7. Print the shortest path between the source and destination.
8. Stop.

Source Code:
#include<stdio.h>
#include<conio.h>
int g[20][20],visited[20],d[20],p[20];
int v,e;
void create_graph()
{
int i,j,a,b,w;
printf("Enter the number of vertices : ");
scanf("%d",&v);
printf("Enter the number of edges : ");
scanf("%d",&e);
for(i=1;i<=v;i++)
for(j=1;j<=v;j++)
g[i][j]=0;
for(i=1;i<=v;i++)
{
p[i]=visited[i]=0;
d[i]=32767;
}
for(i=1;i<=e;i++)
{
printf("Enter the edges a,b and weight w : ");
scanf("%d%d%d",&a,&b,&w);
g[a][b]=g[b][a]=w;
}
}
void dijkstra()
{
int source,dest,current,i,dc,l,x,min;
printf("Enter the source and the destination of vertex :");
scanf("%d%d",&source,&dest);
current=source;
d[source]=0;
visited[source]=1;
dc=d[current];
while(visited[dest]!=1)
{
for(i=1;i<=v;i++)
{
if(g[current][i]!=0)
if(visited[i]==0)
if(d[i]>g[current][i]+dc)

{
d[i]=g[current][i]+dc;
p[i]=current;
}
}
min=32767;
for(i=1;i<=v;i++)
{
if(visited[i]==0)
if(d[i]<min)
{
min=d[i];
current=i;
}
}
dc=d[current];
visited[current]=1;
}
printf("Shortest Distance from %d to %d = ",source,dest);
printf("%d\n",d[dest]);
printf("Path=\n");
l=dest;
do
{
x=p[l];
printf("Vertex %d connected to %d\n",l,x);
l=x;
}
while(l!=source);
}

void main()
{
int i;
clrscr();
create_graph();
dijkstra();
getch();
}

Output:
Enter the number of vertices: 5
Enter the number of edges: 5
Enter the edges a,b and weight w : 1
2
3
Enter the edges a,b and weight w : 2
3
4
Enter the edges a,b and weight w : 3
4
5
Enter the edges a,b and weight w : 1
5
6
Enter the edges a,b and weight w : 3
5
4
Enter the source and the destination of vertex : 1
4
Shortest distance from 1 to 4 = 12
Path=
Vertex 4 connected to 3
Vertex 3 connected to 2
Vertex 2 connected to 1

Result:
Hence, the Dijkstras algorithm for finding the shortest path was simulated,
and the required output was displayed.

Exercise No. : 11

DISTANCE VECTOR ROUTING

Date: 03-04-2015
Aim:
To simulate distance vector routing in C language.
Algorithm:
1. Start.
2. Include the necessary header files.
3. In main function
a)
b)
c)
d)
e)
f)
g)
h)
i)
j)
k)

Declare the necessary variables.


Get the total number of routers and name them.
Get the source router name and its neighbours with names.
Get the delay time of ECHO Packet from source to
neighbours.
Get the delay time for each router in the network with its
neighbours.
Calculate new_delay time using above two values.
Calculate the minimum delay and find the min_node using it
for all the routers.
Display the vector table using new_delay time.
Display the routing table using min_delay and min_node
value.
Transmit a message from source to destination by showing
the transmission time and via router name.
Stop.

Source Code:
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
int n,d,i,j,dely[50][50],echo[50],new_delay[50][50],a=65;
int min[50];
char h,b,hh[50],node[50],min_node[50],msg[50];
clrscr();
//Total number of routers in network
printf("Enter the number of nodes in network ");
scanf("%d",&n);

//Set the router names


for(i=1;i<=n;i++)
{
node[i]=a;
a++;
}
//Source Router
fflush(stdin);
printf("Enter the source node ");
scanf("%c",&h);
//Neighbour to the source router
printf("Enter the number of direct neighbour nodes of %c ",h);
scanf("%d",&d);
//Neighbour router names
printf("Enter the neighbour nodes of source\n");
for(i=1;i<=d;i++)
{
fflush(stdin);
scanf("%c",&hh[i]);
}

//Delay for ECHO packet transmission source to neighbouing router


for(i=1;i<=d;i++)
{
printf("Delay while sending ECHO packet from %c to %c ",h,hh[i]);
scanf("%d",&echo[i]);
}

//Delay for each router in network


for(i=1;i<=n;i++)
{
for(j=1;j<=d;j++)
{
if(node[i]!=hh[j])
{
printf("Delay of transmission from %c to %c
",node[i],hh[j]);
scanf("%d",&dely[i][j]);
}
else
dely[i][j]=0;
}
}
//Calculate new delays
for(i=1;i<=n;i++)
{
for(j=1;j<=d;j++)
{
new_delay[i][j]=echo[j]+dely[i][j];
}
}
//Calculate minimum delay
for(i=1;i<=n;i++)
min[i]=999;

for(i=1;i<=n;i++)
{
for(j=1;j<=d;j++)
{
if(min[i]>new_delay[i][j])
{
min[i]=new_delay[i][j];
min_node[i]=hh[j];
}
}
}
clrscr();
//Display the vector table
printf("\tVectors received from %c's %d neighbour\n\n",h,d);
printf("\tTo\t");
for(i=1;i<=d;i++)
{
printf("%c\t",hh[i]);
}
for(i=1;i<=n;i++)
{
printf("\n\t%c\t",node[i]);
for(j=1;j<=d;j++)
{
printf("%d\t",new_delay[i][j]);
}
}
//Display routing table
printf("\n\n\n\tROUTING TABLE FOR %c",h);
printf("\n\n\tNODES");
printf("\tNEW\tLINE\n");
printf("\t\tDELAY\n");
for(i=1;i<=n;i++)
{
if(node[i]==h)
{
min_node[i]='-';
min[i]=0;
}
printf("\n\t%c\t%d\t%c",node[i],min[i],min_node[i]);
}
//Destination router
fflush(stdin);
printf("\n\nEnter the destination node ");
scanf("%c",&b);
//Message
fflush(stdin);
printf("Enter the message to be tranmitted ");
scanf("%s",msg);

//Transmission
for(i=1;i<=n;i++)
{
if(b==node[i])
{

printf("Message is being transmitted....\n");


printf("Please Wait....\n");
delay(1000);
printf("Message transmitted in %d msec through %c
node\n",min[i],min_node[i]);
printf("Message is %s",msg);
}
}
getch();
}

Output:
Enter the number of nodes in network 5
Enter the source node A
Enter the number of direct neighbour nodes of A 3
Enter the neighbour nodes of source
B
C
D
Delay while sending ECHO packet from A to B 2
Delay while sending ECHO packet from A to C 3
Delay while sending ECHO packet from A to D 4
Delay of transmission from A to B 2
Delay of transmission from A to C 3
Delay of transmission from A to D 4
Delay of transmission from B to C 4
Delay of transmission from B to D 0
Delay of transmission from C to B 4
Delay of transmission from C to D 0
Delay of transmission from D to B 0
Delay of transmission from D to C 0

Delay of transmission from E to B 5


Delay of transmission from E to C 2
Delay of transmission from E to D 7

Result:
Hence, the Distance Vector Routing algorithm was implemented
successfully, and the required output was displayed.

S-ar putea să vă placă și