KEMBAR78
Fast Network Recovery with MRC | PDF | Software Testing | Java (Programming Language)
0% found this document useful (0 votes)
6 views122 pages

Fast Network Recovery with MRC

The document introduces a new recovery scheme for IP networks called Multiple Routing Configurations (MRC) that ensures fast recovery from link and node failures without needing to identify the failure's cause. It also discusses Java as a platform-independent programming language, detailing its features, capabilities, and the Java API, which supports various applications including networking. Additionally, it covers TCP/IP socket programming in Java, explaining how to establish reliable connections between clients and servers.

Uploaded by

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

Fast Network Recovery with MRC

The document introduces a new recovery scheme for IP networks called Multiple Routing Configurations (MRC) that ensures fast recovery from link and node failures without needing to identify the failure's cause. It also discusses Java as a platform-independent programming language, detailing its features, capabilities, and the Java API, which supports various applications including networking. Additionally, it covers TCP/IP socket programming in Java, explaining how to establish reliable connections between clients and servers.

Uploaded by

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

1.

INTRODUCTION

As the Internet takes an increasingly central role in our communications


infrastructure, the slow convergence of routing protocols after a network failure becomes a growing
problem. To assure fast recovery from link and node failures in IP networks, we present a new recovery
scheme called Multiple Routing Configurations (MRC). Our proposed scheme guarantees recovery in all
single failure scenarios, using a single mechanism to handle both link and node failures, and without
knowing the root cause of the failure. MRC is strictly connectionless, and assumes only destination based
hop-by-hop forwarding. MRC is based on keeping additional routing information in the routers, and
allows packet forwarding to continue on an alternative output link immediately after the detection of a
failure. It can be implemented with only minor changes to existing solutions. In this paper we present
MRC, and analyze its performance with respect to scalability, backup path lengths, and load distribution
after a failure. We also show how an estimate of the traffic demands in the network can be used to
improve the distribution of the recovered traffic, and thus reduce the chances of congestion when MRC is
used.

1
HARDWARE CONFIGURATION
Hard disk : 40 GB

RAM : 512 MB

Processor Speed : 3.00GHz

Processor : Pentium IV Processor

SOFTWARE SPECIFICATION

The software requirement specification is produced at the culmination of the analysis task. The function
and performance allocated to software as part of system engineering are refined by establishing a
complete information description as functional representation, a representation of system behavior, an
indication of performance requirements and design constraints, appropriate validation criteria.

User Interface

* Swing - Swing is a set of classes that provides more powerful and flexible components that are possible
with AWT. In addition to the familiar components, such as button checkboxes and labels, swing supplies
several exciting additions, including tabbed panes, scroll panes, trees and tables.

* Applet - Applet is a dynamic and interactive program that can run inside a web page displayed by a java
capable browser such as hot java or Netscape.

Software Interface

JDK 1.5

Sql- Server 2000

2
SOFTWARE DESCRIPTION

Java:

Java was conceived by James Gosling, Patrick Naughton, Chris Wrath, Ed Frank, and

Mike Sheridan at Sun Micro system. It is an platform independent programming

language that extends it’s features wide over the network.Java2 version introduces an

new component called “Swing” – is a set of classes that provides more power

& flexible components than are possible with AWT.

- It’s a light weight package, as they are not implemented by platform-specific code.

-Related classes are contained in javax.swing and its sub packages, such as javax.swing.tree.

-Components explained in the Swing have more capabilities than those of AWT

What Is Java?

Java is two things: a programming language and a platform.

The Java Programming Language

Java is a high-level programming language that is all of the following:

Simple

Object-oriented

Distributed

Interpreted

Robust

Secure

Architecture-neutral

Portable

High-performance

Multithreaded

Dynamic

3
Java is also unusual in that each Java program is both compiled and interpreted. With a compiler,
you translate a Java program into an intermediate language called Java byte codes--the platform-
independent codes interpreted by the Java interpreter. With an interpreter, each Java byte code instruction
is parsed and run on the computer. Compilation happens just once; interpretation occurs each time the
program is executed. This figure illustrates how this works.

Java byte codes can be considered as the machine code instructions for the Java Virtual Machine
(Java VM). Every Java interpreter, whether it's a Java development tool or a Web browser that can run
Java applets, is an implementation of the Java VM. The Java VM can also be implemented in hardware.

Java byte codes help make "write once, run anywhere" possible. The Java program can be
compiled into byte codes on any platform that has a Java compiler. The byte codes can then be run on any
implementation of the Java VM. For example, the same Java program can run on Windows NT, Solaris,
and Macintosh.

The Java Platform

A platform is the hardware or software environment in which a program runs. The Java platform
differs from most other platforms in that it's a software-only platform that runs on top of other, hardware-
based platforms. Most other platforms are described as a combination of hardware and operating system.

The Java platform has two components:

The Java Virtual Machine (Java VM)

The Java Application Programming Interface (Java API)

The Java API is a large collection of ready-made software components that provide many useful
capabilities, such as graphical user interface (GUI) widgets. The Java API is grouped into libraries
(packages) of related components.

The following figure depicts a Java program, such as an application or applet, that's running on the Java
platform. As the figure shows, the Java API and Virtual Machine insulates the Java program from
hardware dependencies.

4
As a platform-independent environment, Java can be a bit slower than native code. However,
smart compilers, well-tuned interpreters, and just-in-time byte code compilers can bring Java's
performance close to that of native code without threatening portability.

What Can Java Do?

Probably the most well-known Java programs are Java applets. An applet is a Java program that
adheres to certain conventions that allow it to run within a Java-enabled browser.

However, Java is not just for writing cute, entertaining applets for the World Wide Web ("Web").
Java is a general-purpose, high-level programming language and a powerful software platform. Using the
generous Java API, we can write many types of programs.

The most common types of programs are probably applets and applications, where a Java
application is a standalone program that runs directly on the Java platform.

How does the Java API support all of these kinds of programs?

With packages of software components that provide a wide range of functionality. The core API
is the API included in every full implementation of the Java platform. The core API gives you the
following features:

The Essentials: Objects, strings, threads, numbers, input and output, data structures, system properties,
date and time, and so on.

Applets: The set of conventions used by Java applets.

Networking: URLs, TCP and UDP sockets, and IP addresses.

Internationalization: Help for writing programs that can be localized for users worldwide. Programs can
automatically adapt to specific locales and be displayed in the appropriate language.

Security: Both low-level and high-level, including electronic signatures, public/private key management,
access control, and certificates.

Software components: Known as JavaBeans, can plug into existing component architectures such as
Microsoft's OLE/COM/Active-X architecture, OpenDoc, and Netscape's Live Connect.

Object serialization: Allows lightweight persistence and communication via Remote Method Invocation
(RMI).

Java Database Connectivity (JDBC): Provides uniform access to a wide range of relational databases.

5
Java not only has a core API, but also standard extensions. The standard extensions define APIs for 3D,
servers, collaboration, telephony, speech, animation, and more.

How Will Java Change My Life?

Java is likely to make your programs better and requires less effort than other languages. We
believe that Java will help you do the following:

Get started quickly: Although Java is a powerful object-oriented language, it's easy to learn, especially for
programmers already familiar with C or C++.

Write less code: Comparisons of program metrics (class counts, method counts, and so on) suggest that a
program written in Java can be four times smaller than the same program in C++.

Write better code: The Java language encourages good coding practices, and its garbage collection helps
you avoid memory leaks. Java's object orientation, its JavaBeans component architecture, and its wide-
ranging, easily extendible API let you reuse other people's tested code and introduce fewer bugs.

Develop programs faster: Your development time may be as much as twice as fast versus writing the
same program in C++. Why? You write fewer lines of code with Java and Java is a simpler programming
language than C++.

Avoid platform dependencies with 100% Pure Java: You can keep your program portable by following
the purity tips mentioned throughout this book and avoiding the use of libraries written in other
languages.

Write once, run anywhere: Because 100% Pure Java programs are compiled into machine-independent
byte codes, they run consistently on any Java platform.

Distribute software more easily: You can upgrade applets easily from a central server. Applets
take advantage of the Java feature of allowing new classes to be loaded "on the fly," without recompiling
the entire program.

We explore the java.net package, which provides support for networking. Its creators
have called Java “programming for the Internet.” These networking classes encapsulate the “socket”
paradigm pioneered in the Berkeley Software Distribution (BSD) from the University of California at
Berkeley.

Networking Basics

Ken Thompson and Dennis Ritchie developed UNIX in concert with the C language at Bell
Telephone Laboratories, Murray Hill, New Jersey, in 1969. In 1978, Bill Joy was leading a project at Cal
Berkeley to add many new features to UNIX, such as virtual memory and full-screen display capabilities.
By early 1984, just as Bill was leaving to found Sun Microsystems, he shipped 4.2BSD, commonly
known as Berkeley UNIX.4.2BSD came with a fast file system, reliable signals, interprocess
communication, and, most important, networking. The networking support first found in 4.2 eventually
became the de facto standard for the Internet. Berkeley’s implementation of TCP/IP remains the primary
standard for communications with the Internet. The socket paradigm for inter process and network
communication has also been widely adopted outside of Berkeley.

6
Socket Overview

A network socket is a lot like an electrical socket. Various plugs around the network have
a standard way of delivering their payload. Anything that understands the standard protocol can “plug in”
to the socket and communicate.

Internet protocol (IP) is a low-level routing protocol that breaks data into small packets
and sends them to an address across a network, which does not guarantee to deliver said packets to the
destination.

Transmission Control Protocol (TCP) is a higher-level protocol that manages to reliably


transmit data. A third protocol, User Datagram Protocol (UDP), sits next to TCP and can be used directly
to support fast, connectionless, unreliable transport of packets.

Client/Server

A server is anything that has some resource that can be shared. There are compute
servers, which provide computing power; print servers, which manage a collection of printers; disk
servers, which provide networked disk space; and web servers, which store web pages. A client is simply
any other entity that wants to gain access to a particular server.

In Berkeley sockets, the notion of a socket allows as single computer to serve many
different clients at once, as well as serving many different types of information. This feat is managed by
the introduction of a port, which is a numbered socket on a particular machine. A server process is said to
“listen” to a port until a client connects to it. A server is allowed to accept multiple clients connected to
the same port number, although each session is unique. To mange multiple client connections, a server
process must be multithreaded or have some other means of multiplexing the simultaneous I/O.

Reserved Sockets

Once connected, a higher-level protocol ensues, which is dependent on which port you
are using. TCP/IP reserves the lower, 1,024 ports for specific protocols. Port number 21 is for FTP, 23 is
for Telnet, 25 is for e-mail, 79 is for finger, 80 is for HTTP, 119 is for Netnews-and the list goes on. It is
up to each protocol to determine how a client should interact with the port.

Java and the Net

Java supports TCP/IP both by extending the already established stream I/O interface. Java
supports both the TCP and UDP protocol families. TCP is used for reliable stream-based I/O across the
network. UDP supports a simpler, hence faster, point-to-point datagram-oriented model.

InetAddress

The InetAddress class is used to encapsulate both the numerical IP address and the
domain name for that address. We interact with this class by using the name of an IP host, which is more
convenient and understandable than its IP address. The InetAddress class hides the number inside. As of
Java 2, version 1.4, InetAddress can handle both IPv4 and IPv6 addresses.

Factory Methods

The InetAddress class has no visible constructors. To create an InetAddress object, we


use one of the available factory methods. Factory methods are merely a convention whereby static

7
methods in a class return an instance of that class. This is done in lieu of overloading a constructor with
various parameter lists when having unique method names makes the results much clearer.

Three commonly used InetAddress factory methods are shown here.

static InetAddress getLocalHost( ) throws UnknownHostException

static InetAddress getByName(String hostName) throws UnknowsHostException

static InetAddress[ ] getAllByName(String hostName)

throws UnknownHostException

The getLocalHost( ) method simply returns the InetAddress object that represents the
local host. The getByName( ) method returns an InetAddress for a host name passed to it. If these
methods are unable to resolve the host name, they throw an UnknownHostException.

On the internet, it is common for a single name to be used to represent several machines. In the
world of web servers, this is one way to provide some degree of scaling. The getAllByName ( ) factory
method returns an array of InetAddresses that represent all of the addresses that a particular name
resolves to. It will also throw an UnknownHostException if it can’t resolve the name to at least one
address. Java 2, version 1.4 also includes the factory method getByAddress( ), which takes an IP address
and returns an InetAddress object. Either an IPv4 or an IPv6 address can be used.

Instance Methods

The InetAddress class also has several other methods, which can be used on the objects
returned by the methods just discussed. Here are some of the most commonly used.

Boolean equals (Object other)- Returns true if this object has the same Internet address
as other.

byte[ ] getAddress( )- Returns a byte array that represents the object’s Internet address in
network byte order.

String getHostAddress( )- Returns a string that represents the host address associated with the
InetAddress object.

String get HostName( )- Returns a string that represents the host name associated with the
InetAddress object.

, it returns false.

String to String( )- Returns a string that lists the host name and the IP address for
conveneince. boolean isMulticastAddress( )- Returns true if this Internet address is a multicast address.
Otherwise

Internet addresses are looked up in a series of hierarchically cached servers. That means that your
local computer might know a particular name-to-IP-address mapping autocratically, such as for itself and
nearby servers. For other names, it may ask a local DNS server for IP address information. If that server
doesn’t have a particular address, it can go to a remote site and ask for it. This can continue all the way up
to the root server, called Inter NIC (internic.net).

8
TCP/IP Client Sockets

TCP/IP sockets are used to implement reliable, bidirectional, persistent, point-to-point, stream-
based connections between hosts on the Internet. A socket can be used to connect Java’s I/O system to
other programs that may reside either on the local machine or on any other machine on the Internet.

There are two kinds of TCP sockets in Java. One is for servers, and the other is for clients. The
Server Socket class is designed to be a “listener,” which waits for clients to connect before doing
anything. The Socket class is designed to connect to server sockets and initiate protocol exchanges.

The creation of a Socket object implicitly establishes a connection between the client and
server. There are no methods or constructors that explicitly expose the details of establishing that
connection. Here are two constructors used to create client sockets:

Socket(String hostName, int port) Creates a socket connecting the local host to the
named host and port; can throw an UnknownHostException or anIOException.

Socket(InetAddress ipAddress, int port) Creates a socket using a preexisting InetAddress


object and a port; can throw an IOException.

A socket can be examined at any time for the address and port information associated
with it, by use of the following methods:

InetAddress getInetAddress( )- Returns the InetAddress associated with the Socket


object.

int getPort( ) Returns the remote port to which this Socket object is connected.

int getLocalPort( ) Returns the local port to which this Socket object is connected.

Once the Socket object has been created, it can also be examined to gain access to the
input and output streams associated with it. Each of these methods can throw an IOException if the
sockets have been invalidated by a loss of connection on the Net.

InputStream getInputStream( )Returns the InputStream associated with the invoking


socket.

OutputStream getOutputStream( ) Returns the OutputStream associated with the invoking socket.

TCP/IP Server Sockets

Java has a different socket class that must be used for creating server applications. The
ServerSocket class is used to create servers that listen for either local or remote client programs to
connect to them on published ports. ServerSockets are quite different form normal Sockets.

When we create a ServerSocket, it will register itself with the system as having an
interest in client connections. The constructors for ServerSocket reflect the port number that we wish to
accept connection on and, optionally, how long we want the queue for said port to be. The queue length
tells the system how many client connection it can leave pending before it should simply refuse
connections. The default is 50. The constructors might throw an IOException under adverse conditions.
Here are the constructors:

ServerSocket(int port) Creates server socket on the specified port with a queue length of 50.

9
Serversocket(int port, int maxQueue)-Creates a server socket on the specified port with a
maximum queue length of maxQueue.

ServerSocket(int port, int maxQueue, InetAddress localAddress)-Creates a server socket on the


specified port with a maximum queue length of maxQueue. On a multihomed host, localAddress specifies
the IP address to which this socket binds.

ServerSocket has a method called accept( ), which is a blocking call that will wait for a client to
initiate communications, and then return with a normal Socket that is then used for communication with
the client.

URL

The Web is a loose collection of higher-level protocols and file formats, all unified in a
web browser. One of the most important aspects of the Web is that Tim Berners-Lee devised a scaleable
way to locate all of the resources of the Net. The Uniform Resource Locator (URL) is used to name
anything and everything reliably.

The URL provides a reasonably intelligible form to uniquely identify or address


information on the Internet. URLs are ubiquitous; every browser uses them to identify information on the
Web. Within Java’s network class library, the URL class provides a simple, concise API to access
information across the Internet using URLs.

Format

Two examples of URLs are http;//www.osborne.com/ and http://


www.osborne.com:80/index.htm.

A URL specification is based on four components. The first is the protocol to use,
separated from the rest of the locator by a colon (:). Common protocols are http, ftp, gopher, and file,
although these days almost everything is being done via HTTP. The second component is the host name
or IP address of the host to use; this is delimited on the left by double slashes (/ /) and on the right by a
slash (/) or optionally a colon (:) and on the right by a slash (/). The fourth part is the actual file path.
Most HTTP servers will append a file named index.html or index.htm to URLs that refer directly to a
directory resource.

Java’s URL class has several constructors, and each can throw a

MalformedURLException. One commonly used form specifies the URL with a string that is identical to
what is displayed in a browser:

URL(String urlSpecifier)

The next two forms of the constructor breaks up the URL into its component parts:

URL(String protocolName, String hostName, int port, String path)

URL(String protocolName, String hostName, String path)

Another frequently used constructor uses an existing URL as a reference context and then
create a new URL from that context.

URL(URL urlObj, String urlSpecifier)

10
The following method returns a URLConnection object associated with the invoking
URL object. it may throw an IOException.

URLConnection openConnection( )-It returns a URLConnection object associated with the


invoking URL object. it may throw an IOException.

JDBC

In an effort to set an independent database standard API for Java, Sun Microsystems developed Java
Database Connectivity, or JDBC. JDBC offers a generic SQL database access mechanism that provides a
consistent interface to a variety of RDBMS. This consistent interface is achieved through the use of
“plug-in” database connectivity modules, or drivers. If a database vendor wishes to have JDBC support,
he or she must provide the driver for each platform that the database and Java run on.

To gain a wider acceptance of JDBC, Sun based JDBC’s framework on ODBC. As you discovered earlier
in this chapter, ODBC has widespread support on a variety of platforms. Basing JDBC on ODBC will
allow vendors to bring JDBC drivers to market much faster than developing a completely new
connectivity solution.

JDBC Goals

Few software packages are designed without goals in mind. JDBC is one that, because of its many goals,
drove the development of the API. These goals, in conjunction with early reviewer feedback, have
finalized the JDBC class library into a solid framework for building database applications in Java.

The goals that were set for JDBC are important. They will give you some insight as to why certain classes
and functionalities behave the way they do. The eight design goals for JDBC are as follows:

SQLevelAPI
The designers felt that their main goal was to define a SQL interface for Java. Although not the lowest
database interface level possible, it is at a low enough level for higher-level tools and APIs to be created.
Conversely, it is at a high enough level for application programmers to use it confidently. Attaining this
goal allows for future tool vendors to “generate” JDBC code and to hide many of JDBC’s complexities
from the end user.

SQLConformance
SQL syntax varies as you move from database vendor to database vendor. In an effort to support a wide
variety of vendors, JDBC will allow any query statement to be passed through it to the underlying
database driver. This allows the connectivity module to handle non-standard functionality in a manner
that is suitable for its users.

JDBC must be implemental on top of common database interfaces


The JDBC SQL API must “sit” on top of other common SQL level APIs. This goal allows JDBC to use
existing ODBC level drivers by the use of a software interface. This interface would translate JDBC calls
to ODBC and vice versa.

11
Provide a Java interface that is consistent with the rest of the Java system
Because of Java’s acceptance in the user community thus far, the designers feel that they should not stray
from the current design of the core Java system.

Keep it simple
This goal probably appears in all software design goal listings. JDBC is no exception. Sun felt that the
design of JDBC should be very simple, allowing for only one method of completing a task per
mechanism. Allowing duplicate functionality only serves to confuse the users of the API.

Use strong, static typing wherever possible


Strong typing allows for more error checking to be done at compile time; also, less errors appear at
runtime.

Keep the common cases simple


Because more often than not, the usual SQL calls used by the programmer are simple SELECT’s,
INSERT’s, DELETE’s and UPDATE’s, these queries should be simple to perform with JDBC.
However, more complex SQL statements should also be possible.

12
SYSTEM ANALYSIS

1. Existing System

 Link and Node failures of IP networks.

 The slow convergence of routing protocols after a network failure becomes a growing problem.

 packet loss or packet delay due to congestion.

 Time consumed to send the data is increased due to resending of lost data.

DISADVATAGES:

 Load Distribution failed.


 Congestion occurring.
 There is no guarantee for data to reach the destination
 There is no back-up path
 It is time consuming
 It has no precise knowledge of failure locations
2. Proposed System

 We present a new scheme for handling link and node failures in IP networks.

 Multiple Routing Configurations (MRC) is a proactive and local protection mechanism


that allows recovery in the range of milliseconds.

 MRC allows packet forwarding to continue over preconfigured alternative next-hops


immediately after the detection of the failure.

 Recovery in all single failure scenarios without knowing root cause of the failure.

 Each and Every Node having Preconfigured Backup Path. That Backup path maintains
the routing table.

 MRC assumes only destination of hop by hop forwarding.

13
ADVANTAGES:

 100% message transfer is guaranteed.

 During message transfer the load is distributed which increases the speed of transmission.

 Overcome retransmission of large data.

 Reduces traffic on the same link.

 The failure of particular link is identified

In our proposed System overcome all the disadvantages of Existing System.

Modules

The modules that are included in this project are

 Topology Construction

 Restrict and Isolate Link

 Routing Table (Backup Path)

 Data Transmission

Module 1: Topology Construction

 In this module is used to construct the topology.


 The user gives the number of node used to construct the topology.
 The node is added to give the name of the node, system number and port address of that
node.
 If the node name and port address is already available means to display the message box
"Node already Add", otherwise to display the message box "Node add successfully".

14
Module 2 Restrict and Isolate Link

 In this module is used to restrict and Isolate the Link.


 Each and Every node having a related link in Jlist box.
 User selects the particular link and Click the Restrict button clicked means the particular link
weight is increased.
 Message Transmission time sender node does not use the particular link.
 Sender node finds the backup path to send the messages from source to destination.
 User selects the particular link and Click the Isolate button clicked means the particular link is
Eliminated form the Database.
 Message Transmission time sender node does not use the particular link.
 Sender node finds the backup path to send the messages from source to destination.

Module 3 Routing Table (Backup Path)

 In this module is used to maintaining preconfigured Backup path (Routing Table).


 If any of the node or link is Restricted means weight value is increased.
 At the time we can’t use the particular link or node. Sender node searches the Corresponding
preconfigured backup to the routing table.
 In the sender node uses the backup path to send the packets from source to destination.
 Acknowledgement will be received from the same backup path.
 No (link or node) failure means Sender sends Messages from the source to destination sender
using the directed path .
 If any of the node or link is isolated means weight value is increased.
 At the time we can’t use the particular link or node is permanently. Sender node searches the
Corresponding preconfigured backup to the routing table.
 In the sender node uses the backup path to send the packets from source to destination.
 Acknowledgement will be received from the same backup pathj

Module 4: Data Transmission

 In the Data Transmission module, the Message transfer relates with that the sender node wants
to send a message to the destination node
 Sender node first selects the Destination node.
 Sender types the data or browses the .txt file and uploads the url from the textbox.
 Checks the corresponding node and corresponding path is available .
 After the path is selected also find out that node or link is failure and status of the destination
node through is true.
 If anyone of the node or link is failed means sender use the preconfigured backup path.
 The receiver node receives the message completely and then it send the acknowledgement to the
sender node also near by nodes through the router nodes where it is received the message.

15
DIAGRAMS

Data Flow Diagram:

16
System Architecture

USER

TOPOLOGY DATA TRANSMISSION ROUTING


CONSTRUCTION TABLE/BACKUP PATH

SQL

17
CLASS DIAGRAM:

USECASE DIAGRAM:

18
Database Schema

DATABASE NAME: MRC


TABLE NAME: newnodedetails

NAME DATA TYPE

nodename nvarchar

ipaddress nvarchar

portno nvarchar

TABLE NAME: edgedetails

NAME DATA TYPE

sourcenode nvarchar

destinationnode nvarchar

weights nvarchar

TABLE NAME: findedpath

NAME DATA TYPE

Destination nvarchar

path nvarchar

weights nvarchar

19
System Testing

The purpose of testing is to discover errors. Testing is the process of trying to discover every conceivable
fault or weakness in a work product. It provides a way to check the functionality of components, sub
assemblies, assemblies and/or a finished product It is the process of exercising software with the intent of
ensuring that the Software system meets its requirements and user expectations and does not fail in an
unacceptable manner. There are various types of test. Each test type addresses a specific testing
requirement.

Types of Tests

Unit testing
Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program input produce valid outputs. All decision branches and internal
code flow should be validated. It is the testing of individual software units of the application .it is done
after the completion of an individual unit before integration. This is a structural testing, that relies on
knowledge of its construction and is invasive. Unit tests perform basic tests at component level and test a
specific business process, application, and/or system configuration. Unit tests ensure that each unique
path of a business process performs accurately to the documented specifications and contains clearly
defined inputs and expected results.

Functional test
Functional tests provide systematic demonstrations that functions tested are available as specified
by the business and technical requirements, system documentation, and user manuals.

Functional testing is centered on the following items:

Valid Input : identified classes of valid input must be accepted.

Invalid Input : identified classes of invalid input must be rejected.

Functions : identified functions must be exercised.

Output : identified classes of application outputs must be exercised.

Systems/Procedures: interfacing systems or procedures must be invoked.

20
System Test
System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the configuration
oriented system integration test. System testing is based on process descriptions and flows, emphasizing
pre-driven process links and integration points.

Performance Test
The Performance test ensures that the output be produced within the time limits, and the time
taken by the system for compiling, giving response to the users and request being send to the system for
to retrieve the results.

Integration Testing
Software integration testing is the incremental integration testing of two or more integrated
software components on a single platform to produce failures caused by interface defects.

The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company level – interact
without error.

Integration testing for Server Synchronization:

Testing the IP Address for to communicate with the other Nodes

Check the Route status in the Cache Table after the status information is received by the Node

The Messages are displayed throughout the end of the application

Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant participation by
the end user. It also ensures that the system meets the functional requirements.

Acceptance testing for Data Synchronization:

The Acknowledgements will be received by the Sender Node after the Packets are received by the
Destination Node

The Route add operation is done only when there is a Route request in need

The Status of Nodes information is done automatically in the Cache Updation process

21
IMPLEMENTATION
Implementation is the stage in the project where the theoretical design is turned into a working
system and is giving confidence on the new system for the users, which it will work efficiently and
effectively. It involves careful planning, investigation of the current System and its constraints on
implementation, design of methods to achieve the change over, an evaluation, of change over methods.
Apart from planning major task of preparing the implementation are education and training of users.
The more complex system being implemented, the more involved will be the system analysis and the
design effort required just for implementation.

An implementation co-ordination committee based on policies of individual organization has


been appointed. The implementation process begins with preparing a plan for the implementation of
the system. According to this plan, the activities are to be carried out, discussions made regarding the
equipment and resources and the additional equipment has to be acquired to implement the new
system.

Implementation is the final and important phase, the most critical stage in achieving a successful
new system and in giving the users confidence. That the new system will work is effective .The system
can be implemented only after through testing is done and if it found to working according to the
specification. This method also offers the greatest security since the old system can take over if the
errors are found or inability to handle certain type of transactions while using the new system.

22
User Training
After the system is implemented successfully, training of the user is one of the most important
subtasks of the developer. For this purpose user manuals are prepared and handled over to the user to
operate the developed system. Thus the users are trained to operate the developed systems
successfully in future .In order to put new application system into use, the following activities were
taken care of:

Preparation of user and system documentation

Conducting user training with demo and hands on

Test run for some period to ensure smooth switching over the system.

The users are trained to use the newly developed functions. User manuals describing the procedures for
using the functions listed on menu and circulated to all the users .it is confirmed that the system is
implemented up to user need and expectations.

Security

The Administrator checks the path information and status information before the data transfer

Messages that are sent will receive the acknowledgements automatically if there is no link failure after
the message received by the Receiver Node

Failure of link’s will automatically make updation in the Cache table to other nodes in the Network

We used two optimizations for our algorithm.

First, to reduce duplicate notifications to a node, we attach a reference list to each notification. The node
detecting a link failure is the root, initializing the list to be its notification list. Each child notifies only the
nodes not in the list and updates the list

By adding the nodes in its notification list. The graph will be close to a tree.

Second, we piggyback a notification on the data packet that encounters a broken link if that packet can
be salvaged. When using the algorithm, we also use a small list of broken links, which is similar to the
negative cache proposed in prior work, to prevent a node from being re-polluted by in-flight stale
routes.

23
Appendix B: Sample Source Code

AddNode.java:

/****************************************************************/
/* AddNode */

/* */

/****************************************************************/

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

/**

24
* Summary description for AddNode

*/

public class AddNode extends JFrame

// Variables declaration

private JLabel jLabel2;

private JLabel jLabel3;

private JLabel jLabel4;

private JLabel jLabel5;

private JLabel jLabel6;

private JTextField jTextField1;

private JTextField jTextField2;

private JTextField jTextField3;

private JButton ADD;

private JButton FINISH;

private JPanel contentPane;

// End of variables declaration

Statement st;

Connection con;

public AddNode()

25
initializeComponent();

//

// TODO: Add any constructor code after initializeComponent call

//

this.setVisible(true);

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con=DriverManager.getConnection("jdbc:odbc:MRC","sa","");

st=con.createStatement();

st.executeUpdate("delete from newnodedetails");

catch (Exception ex)

ex.printStackTrace();

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always regenerated

* by the Windows Form Designer. Otherwise, retrieving design might not work properly.

26
* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder

* to retrieve your design properly in future, before revising this method.

*/

private void initializeComponent()

jLabel2 = new JLabel();

jLabel3 = new JLabel();

jLabel4 = new JLabel();

jLabel5 = new JLabel();

jLabel6 = new JLabel();

jTextField1 = new JTextField();

jTextField2 = new JTextField();

jTextField3 = new JTextField();

ADD = new JButton();

FINISH = new JButton();

contentPane = (JPanel)this.getContentPane();

//

// jLabel2

//

jLabel2.setText("Node Name");

//

// jLabel3

//

jLabel3.setText("TOPOLOGY CONSTRUCTION");

27
//

// jLabel4

//

jLabel4.setText("IP Address");

//

// jLabel5

//

jLabel5.setText("Port No");

jLabel6.setIcon(new ImageIcon("C:\\Documents and Settings\\shi\\Desktop\\MRC\\


images\\images.jpg"));

jLabel6.setText("jLabel6");

//

// jTextField1

//

jTextField1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jTextField1_actionPerformed(e);

});

//

// jTextField2

//

28
jTextField2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jTextField2_actionPerformed(e);

});

//

// jTextField3

//

jTextField3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jTextField3_actionPerformed(e);

});

//

// ADD

//

ADD.setText("ADD");

ADD.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

ADD_actionPerformed(e);

29
}

});

FINISH.setText("FINISH");

FINISH.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

FINISH_actionPerformed(e);

});

//

// contentPane

//

contentPane.setLayout(null);

contentPane.setBackground(new Color(204, 204, 0));

addComponent(contentPane, jLabel2, 72,70,60,32);

addComponent(contentPane, jLabel3, 113,11,150,30);

addComponent(contentPane, jLabel4, 72,120,60,18);

addComponent(contentPane, jLabel5, 71,162,60,18);

addComponent(contentPane, jLabel6, -314,1,701,275);

addComponent(contentPane, jTextField1, 167,73,100,22);

addComponent(contentPane, jTextField2, 166,117,100,22);

addComponent(contentPane, jTextField3, 167,157,100,22);

addComponent(contentPane, ADD, 77,214,83,28);

addComponent(contentPane, FINISH, 177,214,83,28);

30
//

// AddNode

//

this.setTitle("AddNode - extends JFrame");

this.setLocation(new Point(0, 0));

this.setSize(new Dimension(390, 300));

/** Add Component Without a Layout Manager (Absolute Positioning) */

private void addComponent(Container container,Component c,int x,int y,int width,int height)

c.setBounds(x,y,width,height);

container.add(c);

//

// TODO: Add any appropriate code in the following Event Handling Methods

//

private void jTextField1_actionPerformed(ActionEvent e)

System.out.println("\njTextField1_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

31
private void jTextField2_actionPerformed(ActionEvent e)

System.out.println("\njTextField2_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

private void jTextField3_actionPerformed(ActionEvent e)

System.out.println("\njTextField3_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

private void ADD_actionPerformed(ActionEvent e)

try

System.out.println("\nADD_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

String s1=jTextField1.getText();

String s2=jTextField2.getText();

String s3=jTextField3.getText();

32
String sql="insert into newnodedetails values('"+s1+"','"+s2+"','"+s3+"')";

st.executeUpdate(sql);

System.out.println(" values are inserted successfully");

JOptionPane.showMessageDialog(null,"Data Added sucessfully");

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

catch(Exception e1)

e1.printStackTrace ();

private void FINISH_actionPerformed(ActionEvent e)

33
System.out.println("finish button clicked");

this.setVisible(false);

pathcon p = new pathcon();

//

// TODO: Add any method code to meet your needs in the following area

//

NODEA.java

/****************************************************************/

/* NODEA */

/* */

/****************************************************************/

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.event.*;

import java.io.*;

34
import java.net.*;

import java.util.*;

import java.sql.*;

import javax.swing.table.*;

/**

* Summary description for NODEA

*/

public class NODEA extends JFrame

// Variables declaration

private JTabbedPane jTabbedPane1;

private JPanel contentPane;

//-----

private JLabel jLabel2;

private JLabel jLabel3;

private JLabel lab_list;

private JLabel lab1_list;

private JLabel messge_label;

private JLabel receive_label;

private JTextField jTextField1;

private JComboBox combo;//DESTINATION ADDRESS

35
private JTextField txt_path;//BROWSE FILE PATH

private JList jList1;

private JScrollPane jScrollPane1;

private JButton jButton1;// SEND BUTTON

private JButton jButton2;// BROWSE BUTTON

private JPanel NODE;

private JTextArea jTextArea2; //SENDING MESSAGE

private JScrollPane jScrollPane2;

private JTextArea jTextArea3; //RECEVING MESSAGE

private JScrollPane jScrollPane3;

private JButton jButton3;//CLEAR BUTTON

private JButton jButton4;// RESTRICT BUTTON

private JButton LINKFAILURE;// LINK FAILURE BUTTON

private JTable tab;

Pathtable pathtab;

Object header[]={"SOURCENODE","DESTINATIONNODE","BACKUPPATH"};

//-----

private JPanel ROUTER;

36
String findedpath1="";

String str="";

String nodename="A";

int portt;

String ipaddress="";

String fname="";

String sender="";

String nexthost="";

Vector v1=new Vector();

Vector v2=new Vector();

Vector vv=new Vector();

//-----

// End of variables declaration

public NODEA()

super();

initializeComponent();

//

// TODO: Add any constructor code after initializeComponent call

//

37
this.setVisible(true);

start();

getrelatednodes();

bckuppath();

try

Socket s=new Socket("localhost",5690);

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

out.writeUTF("getnodeport");

out.writeUTF(nodename);

//out.writeUTF(ipaddress);

DataInputStream in=new DataInputStream(s.getInputStream());

String receive=in.readUTF();

String receive2=in.readUTF();

System.out.println("PORT NUMBER IN NODE A:"+receive);

System.out.println("IP ADDRESS IN NODE A:"+receive2);

38
start();

portt=Integer.parseInt(receive);

serverlisten();

catch (Exception ex)

System.out.println("jwgd:"+ex);

ex.printStackTrace();

public void start()

combo.removeAllItems();

39
try

Socket sd=new Socket("localhost",5690);

DataOutputStream outt=new DataOutputStream(sd.getOutputStream());

outt.writeUTF("getaallnodes");

outt.writeUTF("");

System.out.println("gfghdfjkhsdfjk");

DataInputStream inn=new DataInputStream(sd.getInputStream());

String ar=inn.readUTF();

System.out.println("is1 :"+ar);

String ar1=inn.readUTF();

System.out.println("2nd:"+ar1);

String[] arr=ar.split("@");

40
for (int i=0;i<arr.length ; i++)

System.out.println("inside for :"+arr[i]);

combo.addItem(arr[i]);

catch (Exception ex)

System.out.println(ex);

ex.printStackTrace();

public void serverlisten()

try

ServerSocket node=new ServerSocket(portt);

while (true)

41
Socket s=node.accept();

DataInputStream din=new DataInputStream(s.getInputStream());

String p1=din.readUTF();

String p=din.readUTF();

if(p1.equals("message"))

String[] ss=p.split("&");

int lent=ss[1].length();

if (lent == 1)

jTextArea3.setText(ss[0]);

DataOutputStream din1=new DataOutputStream(s.getOutputStream());

din1.writeUTF("ACK");

else

findedpath1=ss[1];

42
str=ss[0];

sendPackets();

catch (Exception ex)

System.out.println(ex);

ex.printStackTrace();

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always regenerated

43
* by the Windows Form Designer. Otherwise, retrieving design might not work properly.

* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder

* to retrieve your design properly in future, before revising this method.

*/

private void initializeComponent()

jTabbedPane1 = new JTabbedPane();

contentPane = (JPanel)this.getContentPane();

//-----

jLabel2 = new JLabel();

jLabel3 = new JLabel();

messge_label = new JLabel("SEND MSG");

receive_label = new JLabel("RECEIVED MSG");

lab_list= new JLabel("LINK DETAILS");

lab1_list= new JLabel("RESTRICT");

jTextField1 = new JTextField();

//jTextField2 = new JTextField();

txt_path=new JTextField();

jList1 = new JList();

combo = new JComboBox();

jScrollPane1 = new JScrollPane();

jButton1 = new JButton();

jButton2 = new JButton();

jButton3 = new JButton("CLEAR");

jButton4 = new JButton("RESTRICT");

44
LINKFAILURE=new JButton("ISOLATE");

NODE = new JPanel();

jTextArea2 = new JTextArea();

jScrollPane2 = new JScrollPane();

jTextArea3 = new JTextArea();

jScrollPane3 = new JScrollPane();

//-----

ROUTER = new JPanel();

//-----

//

// jTabbedPane1

//

jTabbedPane1.addTab("NODE", NODE);

jTabbedPane1.addTab("ROUTER", ROUTER);

jTabbedPane1.addChangeListener(new ChangeListener() {

public void stateChanged(ChangeEvent e)

jTabbedPane1_stateChanged(e);

});

//

// contentPane

//

45
contentPane.setLayout(null);

addComponent(contentPane, jTabbedPane1, 5,12,458,452);

//

// jLabel2

//

jLabel2.setText("DESTINATION NODE");

//

// jLabel3

//

jLabel3.setText("SELECT FILE");

//

// jTextField1

//

jScrollPane2.setViewportView(jTextArea2);

jTextField1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jTextField1_actionPerformed(e);

});

//

// jTextField2

//

46
//

// jList1

//

jList1.addListSelectionListener(new ListSelectionListener() {

public void valueChanged(ListSelectionEvent e)

jList1_valueChanged(e);

});

//

// jScrollPane1

//

jScrollPane1.setViewportView(jList1);

jScrollPane3.setViewportView(jTextArea3);

//

// jButton1

//

jButton1.setText("SEND");

jButton1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jButton1_actionPerformed(e);

47
});

//

// jButton2

//

jButton2.setText("BROWSE");

jButton2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jButton2_actionPerformed(e);

});

//

// jButton3

//

//jButton3.setText("");

jButton3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jButton3_actionPerformed(e);

});

48
//

// jButton4

//

// jButton4.setText();

jButton4.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jButton4_actionPerformed(e);

});

LINKFAILURE.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

LINKFAILURE_actionPerformed(e);

});

Container con1 = getContentPane();

JScrollPane jsp = new JScrollPane(tab,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,


JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

con1.add(jsp);

tab=new JTable();

49
pathtab=new Pathtable();

pathtab.setColumnIdentifiers(header);

tab.setModel(pathtab);

jsp=new JScrollPane(tab);

//

// NODE

//

NODE.setLayout(null);

addComponent(NODE,jLabel2, 10,30,130,25);

addComponent(NODE,combo, 160,30,90,25);

addComponent(NODE,jLabel3, 10,80,100,25);

addComponent(NODE,txt_path, 90,80,160,25);

addComponent(NODE,lab1_list,359,20,80,20);

addComponent(NODE,lab_list,355,40,80,25);

addComponent(NODE,jScrollPane1,350,65,90,80);

addComponent(NODE,jButton4,350,165,90,25);

addComponent(NODE,LINKFAILURE,350,190,90,25);

50
addComponent(NODE,jButton2,255,80,80,25);

addComponent(NODE,messge_label, 20,130,100,25);

addComponent(NODE,jScrollPane2, 20,160,110,95);

addComponent(NODE,jButton1, 20,270,100,25);

addComponent(NODE,receive_label, 140,130,100,25);

addComponent(NODE,jScrollPane3, 140,160,110,95);

addComponent(NODE,jButton3, 140,270,100,25);

ROUTER.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

addComponent(ROUTER,jsp, 10,30,130,25);

//ROUTER.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

//

// NODEA

//

this.setTitle("NODEA - extends JFrame");

this.setLocation(new Point(0, 0));

this.setSize(new Dimension(550,452));

setDefaultCloseOperation(EXIT_ON_CLOSE);

/** Add Component Without a Layout Manager (Absolute Positioning) */

private void addComponent(Container container,Component c,int x,int y,int width,int height)

51
c.setBounds(x,y,width,height);

container.add(c);

//

// TODO: Add any appropriate code in the following Event Handling Methods

//

private void jTabbedPane1_stateChanged(ChangeEvent e)

System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");

// TODO: Add any handling code here

private void jTextField1_actionPerformed(ActionEvent e)

System.out.println("\njTextField1_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

private void jList1_valueChanged(ListSelectionEvent e)

System.out.println("\njList1_valueChanged(ListSelectionEvent e) called.");

52
if(!e.getValueIsAdjusting())

Object o = jList1.getSelectedValue();

System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");

// TODO: Add any handling code here for the particular object being selected

private void jButton1_actionPerformed(ActionEvent e)

String dest=(String)combo.getSelectedItem();

str=jTextArea2.getText();

System.out.println("Dest"+dest);

try

Socket ss=new Socket("localhost",5690);//1680

DataOutputStream dos=new DataOutputStream(ss.getOutputStream());

DataInputStream dis=new DataInputStream(ss.getInputStream());

dos.writeUTF("getnodeport1");

dos.writeUTF(nodename+"#"+dest);

findedpath1=dis.readUTF();

System.out.println("hghghj:"+findedpath1);

53
sendPackets();

//SendPackets(str,path);

catch (Exception ex)

System.out.println(" exsception in send_actionPerformed:"+ex);

ex.printStackTrace();

public void bckuppath()

try

Vector validpath = new Vector();

Vector Vbck=new Vector();

String validpath1="";

Socket bp=new Socket("localhost",5690);//1680

DataOutputStream bp1=new DataOutputStream(bp.getOutputStream());

//DataInputStream bp2=new DataInputStream(bp.getInputStream());

bp1.writeUTF("getbackuppath");

54
bp1.writeUTF(nodename);

System.out.println("backup path");

DataInputStream op=new DataInputStream(bp.getInputStream());

validpath1=op.readUTF();

System.out.println("final valid path:"+validpath1);

validpath.addElement(validpath1);

System.out.println(" Vector values ::"+validpath);

for(int i=0;i<validpath.size();i++)

String data=String.valueOf(validpath.elementAt(i));

int intlen=data.length();

String strDes=data.substring(intlen-1,intlen);

Vbck.addElement(nodename);

Vbck.addElement(strDes);

Vbck.addElement(data);

System.out.println("Back up Path ::::"+data);

if(data.contains("&"))

adddata(Vbck);

Vbck=new Vector();

55
}

//------------------------END OF SOURCE TO FIND BACK UP PATH.................

Vector validpathdest = new Vector();

Vector Vbckdest=new Vector();

String DESTvalidpath1="";

//Socket bp=new Socket("localhost",5690);//1680

//DataOutputStream bp1=new DataOutputStream(bp.getOutputStream());

//DataInputStream bp2=new DataInputStream(bp.getInputStream());

//bp1.writeUTF("getbackuppath");

//bp1.writeUTF(nodename);

//System.out.println("backup path");

DataInputStream opdest=new DataInputStream(bp.getInputStream());

DESTvalidpath1=opdest.readUTF();

System.out.println("final valid path in Destination:"+DESTvalidpath1);

validpathdest.addElement(DESTvalidpath1);

System.out.println(" Vector values in Destination ::"+validpathdest);

56
for(int i=0;i<validpathdest.size();i++)//dest to back up path to store jtable

String data=String.valueOf(validpath.elementAt(i));

int intlen=data.length();

String strDes=data.substring(intlen-1,intlen);

Vbck.addElement(strDes);

Vbck.addElement(nodename);

Vbck.addElement(data);

System.out.println("Back up Path ::::"+data);

if(data.contains("&"))

adddata(Vbck);

Vbck=new Vector();

57
//valid.add(validpath);

// System.out.println("back"+validpath);

//

// Iterator e2=validpath.iterator();

//

// String strValues="",strBPath="";

//

// while (e2.hasNext())

// {

// strValues+=e2.next().toString()+"&";

// }

// System.out.println("Records "+strValues);

//

// String [] bckpath=strValues.split("&");

// for(int i=0;i<bckpath.length;i++)

// {

// strBPath=bckpath[i];

//

// }

58
}

catch (Exception x)

x.printStackTrace();

public void getrelatednodes()

try

Socket s2s=new Socket("localhost",5690);//1680

59
DataOutputStream dal=new DataOutputStream(s2s.getOutputStream());

DataInputStream di=new DataInputStream(s2s.getInputStream());

dal.writeUTF("getalllinks");

dal.writeUTF(nodename);

String allpaths=di.readUTF();

//allpaths=jList1.setText();

//list_view.setListData(vector_list);

//jList1.setListData(allpaths);

System.out.println("helllllllllllllloooooooo:"+allpaths);

String[] arr_ap=allpaths.split("&");

Vector inn=in(arr_ap[0]);

Vector outt=out(arr_ap[1]);

// Vector vv=new Vector();

Enumeration e1=inn.elements();

while (e1.hasMoreElements())

60
vv.addElement(e1.nextElement());

Enumeration e2=outt.elements();

while (e2.hasMoreElements())

vv.addElement(e2.nextElement());

//jList1.setListData(inn);

jList1.setListData(vv);

catch (Exception ex)

System.out.println(" exsception in getrelatednodes Method:"+ex);

ex.printStackTrace();

public Vector in(String inarr)

61
{

System.out.println("in in loop");

String[] aa1=inarr.split("-");

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

v1.addElement(nodename+">"+aa1[i]);

return v1;

public Vector out(String outarr)

System.out.println("in out loop");

String[] aa1=outarr.split("-");

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

v2.addElement(aa1[i]+">"+nodename);

return v2;

public void sendPackets()

try

System.out.println("----fpppp----------------:"+findedpath1);

62
String[] pathh=findedpath1.split(">");

System.out.println("pathh value one is:"+pathh[0]);

System.out.println("pathh value two is:"+pathh[1]);

Socket s1s=new Socket("localhost",5690);//1680

DataOutputStream dos1=new DataOutputStream(s1s.getOutputStream());

dos1.writeUTF("getnodeport");

dos1.writeUTF(pathh[1]);//lhost

System.out.println("hghghj;;;;;;;;;:");

DataInputStream diis=new DataInputStream(s1s.getInputStream());

int portno=Integer.parseInt(diis.readUTF());

System.out.println("PORT NUMBER :"+portno);

ipaddress=diis.readUTF();

int len=findedpath1.length();

findedpath1=findedpath1.substring(2,len);

Socket sss=new Socket(ipaddress,portno);

DataOutputStream dout=new DataOutputStream(sss.getOutputStream());

dout.writeUTF("message");

dout.writeUTF(str+"&"+findedpath1);

63
// String ack1=diis.readUTF();

// System.out.println("this is ack"+ack1);

catch (Exception ex)

System.out.println(" exsception in sendPacket Method:"+ex);

ex.printStackTrace();

private void jButton2_actionPerformed(ActionEvent e)

System.out.println("\nBROWSE_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

File file;

JFileChooser fc=new JFileChooser(".");

int val=fc.showOpenDialog(this);

try

if(val==JFileChooser.APPROVE_OPTION)

64
{

file=fc.getSelectedFile();

String path=file.getAbsolutePath();

System.out.println(path);

FileInputStream fis=new FileInputStream(file);

byte[] by1=new byte[fis.available()];

fis.read(by1);

String st1=new String(by1);

jTextArea2.setText(st1);

txt_path.setText(path);

//jTextArea1.setText(path);

catch (Exception ex)

ex.printStackTrace();

private void jButton3_actionPerformed(ActionEvent e)

65
System.out.println("\njButton2_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

jTextArea3.setText("");

private void jButton4_actionPerformed(ActionEvent e)

try

String listval="";

System.out.println("\njButton2_actionPerformed(ActionEvent e) called.");

Socket s1s=new Socket("localhost",5690);//1680

DataOutputStream dos1=new DataOutputStream(s1s.getOutputStream());

String p_name= jList1.getSelectedValue().toString();

//Object [ ] selected=jList1.getSelectedValues();

System.out.println("This is jList1:"+p_name);

dos1.writeUTF("restrictlink");

dos1.writeUTF(p_name);//lhost

System.out.println("RESTRICT LINK WEIGHT:");

DataInputStream diis=new DataInputStream(s1s.getInputStream());

String dmsg1=diis.readUTF();

System.out.println("dialog message is:"+dmsg1);

66
JOptionPane.showMessageDialog(this,dmsg1);

catch (Exception ex)

ex.printStackTrace();

private void LINKFAILURE_actionPerformed(ActionEvent e)

try

System.out.println("Link failure button clicked");

Socket lf=new Socket("localhost",5690);//1680

DataOutputStream dos1=new DataOutputStream(lf.getOutputStream());

String lf_name= jList1.getSelectedValue().toString();

System.out.println("This is jList1:"+lf_name);

dos1.writeUTF("LinkFailure");

dos1.writeUTF(lf_name);//lhost

DataInputStream diis=new DataInputStream(lf.getInputStream());

String dmsg=diis.readUTF();

System.out.println("dialog message is:"+dmsg);

67
JOptionPane.showMessageDialog(this,dmsg);

Object o=jList1.getSelectedValue();

// Vector v=new Vector();

// v.add(o);

System.out.println("*************Vector ele ::"+vv);

vv.remove(o);

System.out.println("*************Vector ele ::"+vv);

jList1.setListData(vv);

//int index=Integer.parseInt(lf_name);

//System.out.println("Index value ::"+index);

//jList1.remove(index);

//jList1.clearSelection();

catch (Exception lf1)

lf1.printStackTrace();

68
public void adddata(Vector vbpath)

System.out.println(" Call the Method :"+vbpath);

pathtab.addRow(vbpath);

class Pathtable extends DefaultTableModel

Pathtable()

//

// TODO: Add any method code to meet your needs in the following area

//

69
70
//============================= Testing ================================//

//= =//

//= The following main method is just for testing this class you built.=//

//= After testing,you may simply delete it. =//

//======================================================================//

public static void main(String[] args)

JFrame.setDefaultLookAndFeelDecorated(true);

JDialog.setDefaultLookAndFeelDecorated(true);

try

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

catch (Exception ex)

System.out.println("Failed loading L&F: ");

System.out.println(ex);

ex.printStackTrace();

new NODEA();

71
}

//= End of Testing =

72
//============================= Testing ================================//

//= =//

//= The following main method is just for testing this class you built.=//

//= After testing,you may simply delete it. =//

//======================================================================//

public static void main(String[] args)

JFrame.setDefaultLookAndFeelDecorated(true);

JDialog.setDefaultLookAndFeelDecorated(true);

try

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

catch (Exception ex)

73
System.out.println("Failed loading L&F: ");

System.out.println(ex);

new AddNode();

//= End of Testing =

HOME.java

/****************************************************************/

/* hOME */

/* */

/****************************************************************/

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

/**

* Summary description for hOME

*/

74
public class Home extends JFrame

// Variables declaration

private JLabel jLabel1;

private JButton jButton1;

private JPanel contentPane;

// End of variables declaration

public Home()

super();

initializeComponent();

//

// TODO: Add any constructor code after initializeComponent call

//

this.setVisible(true);

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always regenerated

* by the Windows Form Designer. Otherwise, retrieving design might not work properly.

* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder

75
* to retrieve your design properly in future, before revising this method.

*/

private void initializeComponent()

jLabel1 = new JLabel();

jButton1 = new JButton();

contentPane = (JPanel)this.getContentPane();

//

// jLabel1

//

jLabel1.setIcon(new ImageIcon("images\\networking2.jpg"));

jLabel1.setText("jLabel1");

//

// jButton1

//

jButton1.setIcon(new ImageIcon("images\\s3.jpg"));

jButton1.setText("jButton1");

jButton1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jButton1_actionPerformed(e);

});

76
//

// contentPane

//

contentPane.setLayout(null);

addComponent(contentPane, jLabel1, -9,2,445,318);

addComponent(contentPane, jButton1, 161,324,114,53);

//

// hOME

//

this.setTitle("hOME - extends JFrame");

this.setLocation(new Point(0, 0));

this.setSize(new Dimension(444, 406));

/** Add Component Without a Layout Manager (Absolute Positioning) */

private void addComponent(Container container,Component c,int x,int y,int width,int height)

c.setBounds(x,y,width,height);

container.add(c);

//

// TODO: Add any appropriate code in the following Event Handling Methods

//

private void jButton1_actionPerformed(ActionEvent e)

77
{

System.out.println("\njButton1_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

this.setVisible(false);

AddNode a = new AddNode();

//

// TODO: Add any method code to meet your needs in the following area

//

78
//============================= Testing ================================//

//= =//

//= The following main method is just for testing this class you built.=//

//= After testing,you may simply delete it. =//

//======================================================================//

public static void main(String[] args)

79
JFrame.setDefaultLookAndFeelDecorated(true);

JDialog.setDefaultLookAndFeelDecorated(true);

try

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

catch (Exception ex)

System.out.println("Failed loading L&F: ");

System.out.println(ex);

new Home();

//= End of Testing =

path.java

80
import java.sql.*;

import java.util.*;

public class path

//private sql DB;

Connection conn;

private Statement st;

private ResultSet rs;

private String printPath = "";

private int index = -1;

private String stack[] = new String[100];

private boolean flip = true,flip1 = true, flip2 = false;

public static Vector <String> vPathWeigth = new Vector<String>();

private int weight = 0;

private static String strDest = "";

private static String strStart= "";

public path( String start,String strDst )

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

81
conn = DriverManager.getConnection("jdbc:odbc:MRC");

st = conn.createStatement();

st.execute("delete findedpath");

// DB= new sql();

// st=DB.connect();

//System.out.println(start);

//System.out.println(strDst);

//st.execute("delete possibledelay");

strDest = strDst;

strStart = start;

flip = true;

flip1 = true;

flip2 = false;

index = -1;

weight = 0;

getPath( start );

catch( Exception e )

e.printStackTrace( );

82
}

public void getPath( String start )

try

rs = st.executeQuery( "select * from edgedetails where sourcenode like '"+start.trim( )


+"'");

while( rs.next( ) )

flip2 = true;

if( flip == false )

for( int i=0;i < index;i++ )

stack[i] = stack[i+1];

index--;

flip = true;

83
}

String check = rs.getString( 2 );

String strarray[ ] = strStart.split( ">" );

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

//System.out.println("entered2");

if( strarray[i].equalsIgnoreCase( check ))

//System.out.println("entered3");

flip1 = false;

if( flip1 == true )

stack[ ++index ] = strStart + ">" + check;

flip1 = true;

} // end of while loop

if( flip2 == true )

84
{

flip2 = false;

for( int i = 0;i <= index;i++ )

findNode( stack[i] );

else

for( int i = 0; i < index; i++ )

stack[ i ] = stack[ i+1 ];

index--;

flip2 = true;

findNode( stack[0] );

}catch( Exception e ) { e.printStackTrace( ); }

public void findNode( String nodePath )

strStart = nodePath;

85
//System.out.println("bhghg");

int end = nodePath.lastIndexOf(">");

if(nodePath.substring(end + 1).equals(strDest))

findWeight( nodePath );

if( index != 0 )

for( int i = 0; i <= index; i++ )

stack[i] = stack[i+1];

index--;

flip = true;

strStart = stack[0];

findNode( stack[0] );

else

flip = false;

getPath( nodePath.substring(end + 1) );

// getPath( nodePath.substring( nodePath.length( )-1) , nodePath.substring( nodePath.length( )-3,


(nodePath.length( )-3) + 1 ) );

86
public void findWeight( String nodePath )

String[] strArray = nodePath.split(">");

try

for( int i = 0;i < strArray.length-1;i++ )

rs = st.executeQuery("select * from edgedetails where sourcenode =


'"+strArray[i].trim( )+"' AND destinationnode='"+strArray[i+1].trim( )+"'");

if( rs.next())

weight += rs.getInt(3);

System.out.println("Path-->"+nodePath);

System.out.println("Weight-->"+weight);

String pathweight =nodePath+"#"+weight;

System.out.println("Find path"+pathweight);

if(rs.next())

87
{

System.out.println( "Already Exist" );

else

st.executeUpdate("insert into findedpath


values( '"+strDest+"','"+nodePath+"',"+weight+" )" );

System.out.println( "weight"+weight );

//cost = 0;

weight = 0;

System.out.println("Find path");

vPathWeigth.add(pathweight);

catch( Exception e )

e.printStackTrace( );

88
pathcon.java

/****************************************************************/

/* pathcon */

/* */

/****************************************************************/

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

/**

* Summary description for pathcon

*/

public class pathcon extends JFrame

// Variables declaration

private JLabel jLabel2;

private JLabel jLabel3;

private JLabel jLabel4;

private JLabel jLabel6;

private JTextField jTextField3;

private JComboBox jComboBox1;

private JComboBox jComboBox2;

89
private JButton CREATE;

private JButton FINISH;

private JPanel contentPane;

Connection con;

Statement st;

// End of variables declaration

public pathcon()

super();

initializeComponent();

//

// TODO: Add any constructor code after initializeComponent call

//

this.setVisible(true);

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

90
con=DriverManager.getConnection("jdbc:odbc:MRC","sa","");

st=con.createStatement();

st.executeUpdate("delete from edgedetails");

catch (Exception e1)

System.out.println(e1);

e1.printStackTrace();

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always regenerated

* by the Windows Form Designer. Otherwise, retrieving design might not work properly.

* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder

* to retrieve your design properly in future, before revising this method.

*/

private void initializeComponent()

jLabel2 = new JLabel();

91
jLabel3 = new JLabel();

jLabel4 = new JLabel();

jLabel6 = new JLabel();

jTextField3 = new JTextField();

jComboBox1 = new JComboBox();

jComboBox2 = new JComboBox();

CREATE = new JButton();

FINISH = new JButton();

contentPane = (JPanel)this.getContentPane();

//

// jLabel2

//

jLabel2.setForeground(new Color(255, 153, 255));

jLabel2.setText("SOURCE NODE NAME");

//

// jLabel3

//

jLabel3.setForeground(new Color(255, 51, 255));

jLabel3.setText(" DESTINATION NODE NAME");

//

// jLabel4

//

jLabel4.setForeground(new Color(255, 51, 255));

jLabel4.setText(" WEIGHTS");

92
//

// jLabel6

//

jLabel6.setIcon(new ImageIcon("C:\\Documents and Settings\\shi\\Desktop\\MRC\\


images\\networking iStock_000005664283Small.jpg"));

jLabel6.setText("jLabel6");

//

// jTextField1

//

//jTextField1.addActionListener(new ActionListener() {

//public void actionPerformed(ActionEvent e)

//{

// jTextField1_actionPerformed(e);

//}

//});

//

// jTextField2

//

//jTextField2.addActionListener(new ActionListener() {

//public void actionPerformed(ActionEvent e)

//{

// jTextField2_actionPerformed(e);

//}

//});

93
//

// jTextField3

//

jTextField3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jTextField3_actionPerformed(e);

});

jComboBox1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jComboBox1_actionPerformed(e);

});

jComboBox2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

jComboBox2_actionPerformed(e);

94
}

});

//

// CREATE

//

CREATE.setForeground(new Color(255, 51, 255));

CREATE.setText("CREATE");

CREATE.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

CREATE_actionPerformed(e);

});

FINISH.setText("FINISH");

95
FINISH.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)

FINISH_actionPerformed(e);

});

//

// contentPane

//

contentPane.setLayout(null);

contentPane.setBackground(new Color(217, 206, 147));

addComponent(contentPane, jLabel2, 19,67,159,18);

addComponent(contentPane, jLabel3, 17,110,183,18);

addComponent(contentPane, jLabel4, 21,152,60,18);

addComponent(contentPane, jComboBox1, 223,67,100,22);

addComponent(contentPane, jComboBox2, 223,107,100,22);

addComponent(contentPane, jTextField3, 223,146,100,22);

//addComponent(contentPane, jComboBox1, 130,66,100,22);

//addComponent(contentPane, jComboBox2, 130,107,100,22);

addComponent(contentPane, CREATE, 118,214,83,28);

addComponent(contentPane, FINISH, 218,214,83,28);

96
addComponent(contentPane, jLabel6, -314,1,701,275);

//

// pathcon

//

this.setTitle("pathcon - extends JFrame");

this.setLocation(new Point(0, 0));

this.setSize(new Dimension(390, 300));

addcombo();

/** Add Component Without a Layout Manager (Absolute Positioning) */

private void addComponent(Container container,Component c,int x,int y,int width,int height)

c.setBounds(x,y,width,height);

container.add(c);

//

// TODO: Add any appropriate code in the following Event Handling Methods

//

private void jTextField3_actionPerformed(ActionEvent e)

97
System.out.println("\njTextField3_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

private void jComboBox1_actionPerformed(ActionEvent e)

System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called.");

Object o = jComboBox1.getSelectedItem();

System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");

// TODO: Add any handling code here for the particular object being selected

private void jComboBox2_actionPerformed(ActionEvent e)

System.out.println("\njComboBox1_actionPerformed(ActionEvent e) called.");

Object o = jComboBox2.getSelectedItem();

System.out.println(">>" + ((o==null)? "null" : o.toString()) + " is selected.");

// TODO: Add any handling code here for the particular object being selected

98
public void addcombo()

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:MRC","sa","");

Statement st=con.createStatement();

String sql12="select * from newnodedetails";

ResultSet rs=st.executeQuery(sql12);

while(rs.next())

String addnode=rs.getString(1);

jComboBox1.addItem(addnode);

jComboBox2.addItem(addnode);

addnode="";

catch (Exception e)

System.out.println(e);

99
private void CREATE_actionPerformed(ActionEvent e)

try

System.out.println("\nADD_actionPerformed(ActionEvent e) called.");

// TODO: Add any handling code here

String s11=(String)jComboBox1.getSelectedItem();

String s22=(String)jComboBox2.getSelectedItem();

String s33=jTextField3.getText();

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:MRC","sa","");

Statement st=con.createStatement();

String sql="insert into edgedetails values('"+s11+"','"+s22+"','"+s33+"')";

st.executeUpdate(sql);

System.out.println(" values are inserted successfully");

JOptionPane.showMessageDialog(null,"Data Added sucessfully");

//jComboBox1.setText("");

//jComboBox2.setText("");

100
jTextField3.setText("");

catch(Exception e1)

e1.printStackTrace();

private void FINISH_actionPerformed(ActionEvent e)

System.out.println("finish button clicked");

this.setVisible(false);

//pathcon p = new pathcon();

//

// TODO: Add any method code to meet your needs in the following area

//

101
102
//============================= Testing ================================//

//= =//

//= The following main method is just for testing this class you built.=//

//= After testing,you may simply delete it. =//

//======================================================================//

public static void main(String[] args)

JFrame.setDefaultLookAndFeelDecorated(true);

JDialog.setDefaultLookAndFeelDecorated(true);

try

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

catch (Exception ex)

System.out.println("Failed loading L&F: ");

System.out.println(ex);

new pathcon();

//= End of Testing =

103
}

104
DIAGRAMS

Data Flow Diagram:

105
System Architecture

USER

TOPOLOGY DATA TRANSMISSION ROUTING


CONSTRUCTION TABLE/BACKUP PATH

SQL

106
CLASS DIAGRAM:

USECASE DIAGRAM:

107
Database Schema

DATABASE NAME: MRC

TABLE NAME: newnodedetails

NAME DATA TYPE

nodename nvarchar

ipaddress nvarchar

portno nvarchar

TABLE NAME: edgedetails

NAME DATA TYPE

sourcenode nvarchar

108
destinationnode nvarchar

weights nvarchar

TABLE NAME: findedpath

NAME DATA TYPE

Destination nvarchar

path nvarchar

weights nvarchar

Appendixes

Appendix A: Screen Shots

109
110
111
112
113
114
115
116
117
118
119
CONCLUSION
We have presented Multiple Routing Configurations as an approach to achieve fast
recovery in IP networks. MRC is based on providing the routers with additional routing configurations,
allowing them to forward packets along routes that avoid a failed component. MRC guarantees recovery
from any single node or link failure in an arbitrary bi-connected network. By calculating backup
configurations in advance, and operating based on locally available information only, MRC can act
promptly after failure discovery. MRC operates without knowing the root cause of failure, i.e., whether
the forwarding disruption is caused by a node or link failure. This is achieved by using careful link weight
assignment according to the rules we have described. The link weight assignment rules also provide
basis for the specification of a forwarding procedure that successfully solves the last hop problem.The
performance of the algorithm and the forwarding mechanism has been evaluated using simulations. We
have shown that MRC scales well: 3 or 4 backup configurations is typically enough to isolate all links and
nodes in our test topologies. MRC backup path lengths are comparable to the optimal backup path
lengths—MRC backup paths are typically zero to two hops longer.We have evaluated the effect MRC has
on the load distribution in the network while traffic is routed in the backup configurations, and we have
proposed a method that minimizes the risk of congestion after a link failure if we have an estimate of
the demand matrix. In the COST239 network, this approach gave a maximum link load after the worst
case link failure that was even lower than after a full IGP re-convergence on the altered topology. MRC
thus achieves fast recovery with a very limited performance penalty.

120
REFERENCES:
[1] D. D. Clark, “The design philosophy of theDARPAinternet protocols,”ACM IGCOMM Comput.
Commun. Rev., vol. 18, no. 4, pp. 106–114,

Aug. 1988.

[2] A. Basu and J. G. Riecke, “Stability issues in OSPF routing,” in Proc.

ACM SIGCOMM, San Diego, CA, Aug. 2001, pp. 225–236.

[3] C. Labovitz, A. Ahuja, A. Bose, and F. Jahanian, “Delayed internet

routing convergence,” IEEE/ACM Trans. Networking, vol. 9, no. 3, pp.

293–306, Jun. 2001.

[4] C. Boutremans, G. Iannaccone, and C. Diot, “Impact of link failures on

VoIP performance,” in Proc. Int. Workshop on Network and Operating

System Support for Digital Audio and Video, 2002, pp. 63–71.

[5] D.Watson, F. Jahanian, and C. Labovitz, “Experiences with monitoring

OSPF on a regional service provider network,” in Proc. 23rd Int. Conf.

Distributed Computing Systems (ICDCS’03), Washington, DC, 2003,

pp. 204–213, IEEE Computer Society.

[6] P. Francois, C. Filsfils, J. Evans, and O. Bonaventure, “Achieving

sub-second IGP convergence in large IP networks,” ACM SIGCOMM

Comput. Commun. Rev., vol. 35, no. 2, pp. 35–44, Jul. 2005.

121
Web Sites:
Java2s.com

Javaranch.com

Books Referred:
Core Java2, Pearson Education-2007, Cay S. Horstmann and Gary Cornell

Java2 – Complete Reference-2007, Herbert Schild

122

You might also like