0% found this document useful (0 votes)
44 views184 pages

Fast ReRouting AnnaFormat Finished2

Uploaded by

Tamil Arasan
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)
44 views184 pages

Fast ReRouting AnnaFormat Finished2

Uploaded by

Tamil Arasan
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

ABSTRACT

It has been observed that transient failures are fairly common in IP

backbone networks and there have been several proposals based on local

rerouting to provide high network availability despite failures. While most of

these proposals are effective in handling single failures, they either cause loops

or drop packets in the case of multiple independent failures. To ensure

forwarding continuity even with multiple failures, we propose Localized On-

demand Link State (LOLS) routing. Under LOLS, each packet carries a blacklist,

which is a minimal set of failed links encountered along its path, and the next

hop is determined by excluding the blacklisted links. We show that the blacklist

can be reset when the packet makes forward progress towards the destination and

hence can be encoded in a few bits. Furthermore, blacklist-based forwarding

entries at a router can be precomputed for a given set of failures requiring

protection. While the LOLS approach is generic, this paper describes how it can

be applied to ensure forwarding to all reachable destinations in case of any two

link or node failures. Our evaluation of this failure scenario based on various real

network topologies reveals that LOLS needs 6 bits in the worst case to convey the

blacklist information. We argue that this overhead is acceptable considering that

LOLS routing deviates from the optimal path by a small stretch only while

routing around failures.


TABLE OF CONTENTS
CHAPTER TITLE PAGE
NO NO
ABSTRACT
LIST OF TABLES
LIST OF FIGURES
LIST OF ABBREVIATIONS

1. INTRODUCTION
1.1. Overview
1.2. Literature Survey
2. SYSTEM STUDY
2.1. Feasibility Study
2.1.1. Economical Feasibility
2.1.2. Technical Feasibility
2.1.3. Social Feasibility
3. LITERATURE SURVEY
3.1. Existing System
3.1.1. Disadvantages Of Existing System
3.2. Proposed System
3.2.1. Advantages Of Proposed System
4. SYSTEM SPECIFICATION
4.1. Hardware Specification
4.2. Software Specification
5. DETAIL DESCRIPTION OF TECHNOLOGY
5.1. Feature of Java
5.2. Introduction to J2EE
6. SYSTEM DESIGN
6.1. Input Design
6.2. Output Design
7. SYSTEM ARCHITECTURE
7.1. System Architecture
7.2. Data Flow Diagram
7.3. UML Diagram
8. SYSTEM IMPLEMENTATION
9. SYSTEM TESTING
9.1. Unit Testing
9.2. Integration Testing
9.3. Validation Testing
9.4. White Box Testing
9.5. Black Box Testing
10. CONCLUSION
APPENDIX - 1.1
APPENDIX - 1.2
REFFERENCE
LIST OF FIGURES
S.NO. FIGURE NO. DESCRIPTION OF FIGURE PAGE NO.
1. 7.1 Architecture Diagram
2. 7.2 Data Flow Diagram
3. 7.3 UML Diagram
7.3.1. Use Case Diagram
7.3.2. Sequence Diagram
7.3.3. Activity Diagram
7.3.4. Class Diagram
LIST OF ABBREVIATIONS

WSN - Wireless Sensor Networks

FNR - Fault Node Recovery

GD - Grade Diffusion Algorithm

DD - Directed Diffusion Algorithm

GA - Genetic Algorithm

1
LIST OF FIGURES

1. Data Flow Diagram


2. System Architechture
3. UML Diagrams
Use case Diagram
Sequence Diagram
Activity Diagram
Class Diagram
4.Screen Shots
Node A
Node B
Node C
Node D
Node E
Node F
Node G
Node H
Node I
Network
Set Cost Values in Network Simulation
Node A with File Selection and Path Selection
Network After detecting fault and failure nodes
Network after sending the packets to destination node
Node A after Sending Packets
Node B with received packets
Node C with received packets
Node H with received packets
Node I (Destination) after receiving the packets from Node A

2
LIST OF TABLES

3
1. INTRODUCTION
1.1 OVERVIEW

The Internet is increasingly being used for mission critical


applications and it is expected to be always available. Unfortunately,
service disruptions happen even in well-managed networks due to link
and node failures. There have been some studies on frequency, duration,
and type of failures in an IP backbone network. [2] reported that failures
are fairly common and most of them are transient: 46% last less than a
minute and 86% last less than ten minutes. To support emerging time-
sensitive applications in today’s Internet, these networks need to survive
failures with minimal service disruption. For example, a disruption time
of longer than 50 ms is considered intolerable for mission-critical
applications [4]. Therefore, providing uninterrupted service availability
despite transient failures is a major challenge for service providers.
While a majority of the failures were observed to be single
failures, one study [2] has found that approximately 30% of unplanned
failures (which constitute 80% of all failures) involve multiple links,
which is a significant fraction that needs to be addressed. Moreover, the
extent of service disruption caused by multiple failures can be quite
significant. Hence, it is important to devise schemes that protect the
network against not only single failures but also multiple independent
failures. Our work is motivated by this need, which is also the focus of
some of the recently proposed routing schemes.
The commonly deployed link state routing protocols such
as OSPF and ISIS are designed to route around failed links but they lack
the resiliency needed to support high availability [1]. The remedies
suggested in [8], [9] can achieve convergence in less than one second.

4
However, bringing it down below the 50ms threshold runs the risk of
introducing routing instability due to hot-potato routing, which can
cause relatively small internal link-state changes to trigger a large churn
of external routes [10]. MPLS [11] can handle transient
failures effectively with its label stacking capability. However, we argue
that it is not scalable to configure many backup label switched paths for
protection against various combinations of multiple independent
failures. In [12], authors attempt to make MPLS based recovery scalable
to multiple failures, but assume that probable failure patterns based on
past statistics on the network failures are known to the MPLS control
plane.
There have been several fast reroute proposals for handling
transient failures in IP networks by having the adjacent nodes perform
local rerouting without notifying the whole network about a failure [13]–
[17]. However, most of these schemes are designed to deal with single or
correlated failures only. Recently, [7] proposed an approach to handle
dual link, but only single node failures. On the other hand, failure
carrying packets (FCP) [5] and packet recycle (PR) [6] try to forward
packets to reachable destinations even in case of arbitrary number of
failures. The drawbacks, however, are that FCP carries failure
information in each packet all the way to the destination whereas PR
forwards packets along long detours.
We propose a scalable Localized On-demand Link State (LOLS)
routing [18] for protection against multiple failures. LOLS considers a
link as degraded1 if its current state (say “down”) is worse than its
globally advertised state (say “up”). Under LOLS, each packet carries a
blacklist (a minimal set of degraded links encountered along its path),
and the next hop is determined by excluding the blacklisted links. A
packet’s blacklist is initially empty and remains empty when there is no
discrepancy between the current and the advertised states of links along

5
its path. But when a packet arrives at a node with a degraded link
adjacent to its next hop, that link is added to the packet’s blacklist. The
packet is then forwarded to an alternate next hop. The packet’s blacklist
is reset to empty when the next hop makes forward progress, i.e., the
next hop has a shorter path to the destination than any of the nodes
traversed by the packet. With these simple steps, LOLS propagates the
state of degraded links only when needed, and as far as necessary, and
ensures loop-free delivery to all reachable destinations.
LOLS has several attractive features: 1) When there are no
degraded links, forwarding under LOLS is identical to shortest path
forwarding; 2) Even with degraded links, LOLS paths deviate from the
optimal only by a small stretch; 3) LOLS forwarding entries can be
precomputed for a given scenario of failures requiring protection; 4) Due
to localized propagation of a packet’s blacklist, it can be conveyed in just
a few bits. With these features, LOLS compares favorably against FCP
and PR. In short, unlike FCP, LOLS propagates failure information only
locally. Compared to PR, forwarding paths are much shorter with LOLS.
We provide a detailed contrast of LOLS with these and other related
works in the next section.

6
1.2. LITERATURE SURVEY

Literature survey is the most important step in software development process. Before

developing the tool it is necessary to determine the time factor, economy n company

strength. Once these things r satisfied, ten next steps are to determine which operating

system and language can be used for developing the tool. Once the programmers start

building the tool the programmers need lot of external support. This support can be

obtained from senior programmers, from book or from websites. Before building the

system the above consideration r taken into account for developing the proposed system.

7
2. SYSTEM STUDY
2.1 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and business proposal is put
forth with a very general plan for the project and some cost estimates. During system
analysis the feasibility study of the proposed system is to be carried out. This is to ensure
that the proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential.

Three key considerations involved in the feasibility analysis are

2.1.1 ECONOMICAL FEASIBILITY

2.1.2 TECHNICAL FEASIBILITY

2.1.3 SOCIAL FEASIBILITY

2.1.1 ECONOMICAL FEASIBILITY

An organization makes good investment on the system. So, they should be


worthful for the amount they spend in the system. Always the financial benefit and equals
or less the cost of the system, but should not exceed the cost.

 The cost of investment is analyzed for the entire system

 The cost of Hardware and Software is also noted.

 Analyzing the way in which the cost can be reduced

Every organization want to reduce there cost but at the same time quality of the Service
should also be maintained. The system is developed according the estimation of the cost
made by the concern. In this project, the proposed system will definitely reduce the cost
and also the manual work is reduced and speed of work is also increased.

8
2.1.2 TECHNICAL FEASIBILITY

The Technical feasibility is the study of the software and how it is included in the
study of our project. Regarding this there are some technical issues that should be noted
they are as follows:

 Is the necessary technique available and how it is suggested and acquired?

 Does the proposed equipment have the technical capacity to hold the data
required using the new system?

 Will the system provide adequate response that is made by the requester at
an periodic time interval

 Can this system be expanded after this project development

 Is there a technique guarantees of accuracy, reliability in case of access of


data and security

The technical issues are raised during the feasibility study of investigating our
System. Thus, the technical consideration evaluates the hardware requirements, software
etc. This system uses JSP as front end and Oracle as back end. They also provide
sufficient memory to hold and process the data. As the company is going to install all the
process in the system it is the cheap and efficient technique.

This system technique accepts the entire request made by the user and the
response is done without failure and delay. It is a study about the resources available and
how they are achieved as an acceptable system. It is

an essential process for analysis and definition of conducting a parallel assessment of


technical feasibility.

Though storage and retrieval of information is enormous, it can be easily handled


by Oracle. As the oracle can be run in any system and the operation does not differ from
one to another. So, this is effective.

9
2.1.3 SOCIAL FEASIBILITY

Proposed project will be beneficial only when they are turned into an information
system and to meet the organization operating requirements. The following issues are
considered for the operation:

 Does this system provide sufficient support for the user and the management?

 What is the method that should be used in this project?

 Have the users been involved in the planning and development of the
projects?

 Will the proposed system cause any harm, bad result, loss of control and
accessibility of the system will lost?

Issues that may be a minor problem will sometimes cause major problem in the
operation. It is the measure of how people can able to work with the system. Finding out
the minor issues that may be the initial problem of the system. It should be a user-
friendly environment. All these aspect should be kept in mind and steps should be taken
for developing the project carefully.

Regarding the project, the system is very much supported and friendly for the
user. The methods are defined in an effective manner and proper conditions are given in
other to avoid the harm or loss of data. It is designed in GUI interface, as working will
be easier and flexible for the user.

They are three basic feasibility studies that are done in every project.

10
3. LITERATURE SURVEY
3.1 EXISTING SYSTEM

The existing system describes the concept of multipath routing from the source to
root within the network. It also has various techniques to handle data loss, delayed
timing, loss of acknowledgement. But it did not describe how the packet to redirected
once node within the path is unavailable or corrupted.

3.2.1 DISADVANTAGES OF EXISTING SYSTEM

When the energy of a sensor node is exhausted, wireless sensor network leaks will
appear, and the failed nodes will not relay data to the other nodes during transmission
processing.

Thus, the other sensor nodes will be burdened with increased transmission processing.

11
3.2 PROPOSED SYSTEM
We propose Fault Node Recovery. Under this technique, each packet carries a
blacklist, which is a minimal set of failed links encountered along its path, and the next
hop is determined by excluding the blacklisted links. We show that the blacklist can be
reset when the packet makes forward progress towards the destination and hence can be
encoded in a few bits.

3.2.1 ADVANTAGES OF PROPOSED SYSTEM


.
The algorithm proposed in this paper is based on the GD algorithm, with the goal of
replacing fewer sensor nodes that are inoperative or have depleted batteries, and of
reusing the maximum number of routing paths
.
These optimizations will ultimately enhance the WSN lifetime and reduce sensor node
replacement cost.

12
4. SYSTEM SPECIFICATION
4.1. HARDWARE CONFIGURATION

The below Hardware Specifications were used in both Server and Client machines
when developing.

Processor : Intel(R) Core(TM) i3


Processor Speed : 3.06 GHz
Ram : 2 GB
Hard Disk Drive : 250 GB
Floppy Disk Drive : Sony
CD-ROM Drive : Sony
Monitor : “17” inches
Keyboard : TVS Gold
Mouse : Logitech

4.2. SOFTWARE CONFIGURATION

The below Software Specifications were used in both Server and Client machines
when developing.

Operating System : Windows 7


Technology Used : Java, JDK 1.6

13
5. DETAIL DESCRIPTION OF TECHNOLOGY
5.1. FEATURE OF JAVA TECHNOLOGY

Java technology is both a programming language and a platform.


The Java Programming Language
The Java programming language is a high-level language that can be
characterized by all of the following buzzwords:

 Simple
 Architecture neutral
 Object oriented
 Portable
 Distributed
 High performance
 Interpreted
 Multithreaded
 Robust
 Dynamic
 Secure

With most programming languages, you either compile or interpret a program so


that you can run it on your computer. The Java programming language is unusual in that
a program is both compiled and interpreted. With the compiler, first you translate a
program into an intermediate language called Java byte codes —the platform-
independent codes interpreted by the interpreter on the Java platform. The interpreter
parses and runs each Java byte code instruction on the computer. Compilation happens
just once; interpretation occurs each time the program is executed. The following figure
illustrates how this works.

14
You can think of Java byte codes as the machine code instructions for the Java
Virtual Machine (Java VM). Every Java interpreter, whether it’s a development tool or a
Web browser that can run applets, is an implementation of the Java VM. Java byte codes
help make “write once, run anywhere” possible. You can compile your program 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. That means that as long as a computer has a Java VM,
the same program written in the Java programming language can run on Windows 2000,
a Solaris workstation, or on an iMac.

The Java Platform


A platform is the hardware or software environment in which a program runs.
We’ve already mentioned some of the most popular platforms like Windows 2000,
Linux, Solaris, and MacOS. Most platforms can be described as a combination of the
operating system and hardware. 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.
The Java platform has two components:
1. The Java Virtual Machine (Java VM)
2. The Java Application Programming Interface (Java API)

15
You’ve already been introduced to the Java VM. It’s the base for the Java platform
and is ported onto various hardware-based platforms.
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 of related classes and interfaces; these libraries are
known as packages.
The next section, What Can Java Technology Do? Highlights what functionality
some of the packages in the Java API provide. The following figure depicts a program
that’s running on the Java platform. As the figure shows, the Java API and the virtual
machine insulate the program from the hardware.

Native code is code that after you compile it, the compiled code runs on a specific
hardware platform. As a platform-independent environment, the Java platform can be a
bit slower than native code. However, smart compilers, well-tuned interpreters, and just-
in-time byte code compilers can bring performance close to that of native code without
threatening portability.
The most common types of programs written in the Java programming language
are applets and applications. If you’ve surfed the Web, you’re probably already familiar
with applets. An applet is a program that adheres to certain conventions that allow it to
run within a Java-enabled browser.
An application is a standalone program that runs directly on the Java platform. A
special kind of application known as a server serves and supports clients on a network.
Examples of servers are Web servers, proxy servers, mail servers, and print servers.
Another specialized program is a servlet. A servlet can almost be thought of as an applet
that runs on the server side. Java Servlets are a popular choice for building interactive
web applications, replacing the use of CGI scripts. Servlets are similar to applets in that
they are runtime extensions of applications. Instead of working in browsers, though,
servlets run within Java Web servers, configuring or tailoring the server.

16
How does the API support all these kinds of programs? It does so with packages
of software components that provides a wide range of functionality. Every full
implementation of the Java platform 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 applets.
 Networking: URLs, TCP (Transmission Control Protocol), UDP (User Data
gram Protocol) sockets, and IP (Internet Protocol) 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
and private key management, access control, and certificates.
 Software Components: Known as JavaBeansTM, can plug into existing
component architectures.
 Object Serialization: Allows lightweight persistence and communication via
Remote Method Invocation (RMI).
 Java Database Connectivity (Jdbctm): Provides uniform access to a wide range
of relational databases.
The Java platform also has APIs for 2D and 3D graphics, accessibility, servers,
collaboration, telephony, speech, animation, and more. The following figure depicts what
is included in the Java 2 SDK.

17
How Will Java Technology Change My Life?
We can’t promise you fame, fortune, or even a job if you learn the Java programming
language. Still, it is likely to make your programs better and requires less effort than
other languages. We believe that Java technology will help you do the following:
1. Get Started Quickly: Although the Java programming language is a powerful
object-oriented language, it’s easy to learn, especially for programmers already
familiar with C or C++.
2. Write Less Code: Comparisons of program metrics (class counts, method counts,
and so on) suggest that a program written in the Java programming language can
be four times smaller than the same program in C++.
3. Write Better Code: The Java programming language encourages good coding
practices, and its garbage collection helps you avoid memory leaks. Its 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.
4. Develop Programs More Quickly: 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 and it is a simpler programming language than C++.
5. Avoid Platform Dependencies With 100% Pure Java: You can keep your
program portable by avoiding the use of libraries written in other languages. The
100% Pure JavaTM Product Certification Program has a repository of historical
process manuals, white papers, brochures, and similar materials online.
6. Write Once, Run Anywhere: Because 100% Pure Java programs are compiled
into machine-independent byte codes, they run consistently on any Java platform.
7. Distribute Software More Easily: You can upgrade applets easily from a central
server. Applets take advantage of the feature of allowing new classes to be loaded
“on the fly,” without recompiling the entire program.

18
ODBC
Microsoft Open Database Connectivity (ODBC) is a standard programming
interface forapplication developers and database systems providers. Before ODBC
became a de facto standard for Windows programs to interface with database systems,
programmers had to use proprietary languages for each database they wanted to connect
to. Now, ODBC has made the choice of the database system almost irrelevant from a
coding perspective, which is as it should be. Application developers have much more
important things to worry about than the syntax that is needed to port their program from
one database to another when business needs suddenly change.
Through the ODBC Administrator in Control Panel, you can specify the particular
database that is associated with a data source that an ODBC application program is
written to use. Think of an ODBC data source as a door with a name on it. Each door will
lead you to a particular database. For example, the data source named Sales Figures
might be a SQL Server database, whereas the Accounts Payable data source could refer
to an Access database. The physical database referred to by a data source can reside
anywhere on the LAN.
The ODBC system files are not installed on your system by Windows 95. Rather,
they are installed when you setup a separate database application, such as SQL Server
Client or Visual Basic 4.0. When the ODBC icon is installed in Control Panel, it uses a
file called ODBCINST.DLL. It is also possible to administer your ODBC data sources
through a stand-alone program called ODBCADM.EXE. There is a 16-bit and a 32-bit
version of this program and each maintains a separate list of ODBC data sources.
From a programming perspective, the beauty of ODBC is that the application can
be written to use the same set of function calls to interface with any data source,
regardless of the database vendor. The source code of the application doesn’t change
whether it talks to Oracle or SQL Server. We only mention these two as an example.
There are ODBC drivers available for several dozen popular database systems. Even
Excel spreadsheets and plain text files can be turned into data sources. The operating
system uses the Registry information written by ODBC Administrator to determine
which low-level ODBC drivers are needed to talk to the data source (such as the interface
to Oracle or SQL Server).

19
The advantages of this scheme are so numerous that you are probably thinking
there must be some catch. The only disadvantage of ODBC is that it isn’t as efficient as
talking directly to the native database interface. ODBC has had many detractors make the
charge that it is too slow. Microsoft has always claimed that the critical factor in
performance is the quality of the driver software that is used. In our humble opinion, this
is true. The availability of good ODBC drivers has improved a great deal recently. And
anyway, the criticism about performance is somewhat analogous to those who said that
compilers would never match the speed of pure assembly language. Maybe not, but the
compiler (or ODBC) gives you the opportunity to write cleaner programs, which means
you finish sooner. Meanwhile, computers get faster every year.

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
RDBMSs. 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 was announced in March of 1996. It was released for a 90 day public
review that ended June 8, 1996. Because of user input, the final JDBC v1.0 specification
was released soon after.
The remainder of this section will cover enough information about JDBC for you to know
what it is about and how to use it effectively. This is by no means a complete overview of
JDBC. That would fill an entire book.

20
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:
1. SQL Level API
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.
2. SQL Conformance
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.
3. 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.
4. 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.
5. 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

21
completing a task per mechanism. Allowing duplicate functionality only serves to
confuse the users of the API.
6. Use strong, static typing wherever possible
Strong typing allows for more error checking to be done at compile time; also, less
error appear at runtime.
7. 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.

Java Program Interpreter

Compilers My Program

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


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

 Simple Architecture-Neutral

 Object-Oriented Portable

 Distributed High-Performance

 Interpreted Multithreaded

 Robust Dynamic

 Secure
Java is also unusual in that each Java program is both compiled and interpreted.
With a compile you translate a Java program into an intermediate language called Java
byte codes the platform-independent code instruction is passed and run on the computer.

22
Compilation happens just once; interpretation occurs each time the program is executed.
The figure illustrates how this works.
You can think of Java byte codes 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. You can compile
your Java program into byte codes on my platform that has a Java compiler. The byte
codes can then be run any implementation of the Java VM. For example, the same Java
program can run Windows NT, Solaris, and Macintosh.

NETWORKING
TCP/IP STACK
THE TCP/IP STACK IS SHORTER THAN THE OSI ONE:

TCP is a connection-oriented protocol; UDP (User Datagram Protocol) is a


connectionless protocol.
IP datagram’s
The IP layer provides a connectionless and unreliable delivery system. It
considers each datagram independently of the others. Any association between datagram
must be supplied by the higher layers. The IP layer supplies a checksum that includes its
own header. The header includes the source and destination addresses. The IP layer
handles routing through an Internet. It is also responsible for breaking up large datagram
into smaller ones for transmission and reassembling them at the other end.

23
UDP
UDP is also connectionless and unreliable. What it adds to IP is a checksum for
the contents of the datagram and port numbers. These are used to give a client/server
model - see later.
TCP
TCP supplies logic to give a reliable connection-oriented protocol above IP. It
provides a virtual circuit that two processes can use to communicate.
Internet Addresses
In order to use a service, you must be able to find it. The Internet uses an address
scheme for machines so that they can be located. The address is a 32 bit integer which
gives the IP address. This encodes a network ID and more addressing. The network ID
falls into various classes according to the size of the network address.
Network Address
Class A uses 8 bits for the network address with 24 bits left over for other
addressing. Class B uses 16 bit network addressing. Class C uses 24 bit network
addressing and class D uses all 32.
Subnet Address
Internally, the UNIX network is divided into sub networks. Building 11 is
currently on one sub network and uses 10-bit addressing, allowing 1024 different hosts.
Host Address
8 bits are finally used for host addresses within our subnet. This places a limit of
256 machines that can be on the subnet.
Total Address

The 32 bit address is usually written as 4 integers separated by dots.

24
Port Addresses
A service exists on a host, and is identified by its port. This is a 16 bit number. To
send a message to a server, you send it to the port for that service of the host that it is
running on. This is not location transparency! Certain of these ports are "well known".
Sockets
A socket is a data structure maintained by the system to handle network
connections. A socket is created using the call socket. It returns an integer that is like a file
descriptor. In fact, under Windows, this handle can be used with Read File and Write File
functions.
#include <sys/types.h>
#include <sys/socket.h>
int socket(int family, int type, int protocol);

Here "family" will be AF_INET for IP communications, protocol will be zero, and type will
depend on whether TCP or UDP is used. Two processes wishing to communicate over a
network create a socket each. These are similar to two ends of a pipe - but the actual pipe
does not yet exist.

JFree Chart

JFreeChart is a free 100% Java chart library that makes it easy for developers to
display professional quality charts in their applications. JFreeChart's extensive feature set
includes:

A consistent and well-documented API, supporting a wide range of chart types;

A flexible design that is easy to extend, and targets both server-side and client-side
applications;
Support for many output types, including Swing components, image files
(including PNG and JPEG), and vector graphics file formats (including PDF, EPS and
SVG);
JFreeChart is "open source" or, more specifically, free software. It is distributed
under the terms of the GNU Lesser General Public Licence (LGPL),

25
Which permits use in proprietary applications?
1. Map Visualizations
Charts showing values that relate to geographical areas. Some examples include:
(a) population density in each state of the United States,
(b) income per capita for each country in Europe,
(c) life expectancy in each country of the world.

The tasks in this project include:


Sourcing freely redistributable vector outlines for the countries of the world,
states/provinces in particular countries (USA in particular, but also other areas);
Creating an appropriate dataset interface (plus default implementation), a
rendered, and integrating this with the existing XYPlot class in JFreeChart; Testing,
documenting, testing some more, documenting some more.
2. Time Series Chart Interactivity
Implement a new (to JFreeChart) feature for interactive time series charts --- to
display a separate control that shows a small version of ALL the time series data, with a
sliding "view" rectangle that allows you to select the subset of the time series data to
display in the main chart.
3. Dashboards
There is currently a lot of interest in dashboard displays. Create a flexible
dashboard mechanism that supports a subset of JFreeChart chart types (dials, pies,
thermometers, bars, and lines/time series) that can be delivered easily via both Java Web
Start and an applet.

4. Property Editors
The property editor mechanism in JFreeChart only handles a small subset of the
properties that can be set for charts. Extend (or reimplement) this mechanism to provide
greater end-user control over the appearance of the charts.

26
5.2. J2EE ARCHITECTURE
The JavaTM 2 SDK, Enterprise Edition (J2EE SDK) is the reference
implementation provided by Sun Microsystems, Inc. The following figure shows the
major elements of the architecture for the J2EE SDK:

FIGURE 1-2 J2EE Architecture

J2EE SERVER

EJB CONTAINER

Enterpirse
Bean
J2EE

Enterpirse
Bean

CLIENT DATA
BASE
WEB
CONTAINER

JSP FILE

SERVLET

27
Server
The J2EE server provides the following services:
 Naming and Directory - allows programs to locate services and components
through the Java Naming and Directory InterfaceTM (JNDI) API
 Authentication - enforces security by requiring users to log in
 HTTP - enables Web browsers to access servlets and Java Server Pages TM (JSP)
files
 EJB - allows clients to invoke methods on enterprise beans
Web Container
The Web container is a runtime environment for JSP files and servlets. Although
these Web components are an important part of a J2EE application, this manual focuses
on enterprise beans. For more information on developing Web components, see the home
pages for the JavaServer PagesTM and Java Servlet technologies.
Java Server Pages
Java Server(TM) Pages is a simple, yet powerful technology for creating and
maintaining dynamic-content web pages. Based on the Java programming language, Java
Server Pages offers proven portability, open standards, and a mature re-usable component
model.
The Java Server Pages architecture enables the separation of content generation
from content presentation. This separation not only eases maintenance headaches, it also
allows web team members to focus on their areas of expertise. Now, web page designers
can concentrate on layout, and web application designers on programming, with minimal
concern about impacting each other's work.
The rest of this document gives you the bigger picture:
 Portability
 Composition
 Processing
 Access Models

28
Portability
Java Server Pages files can be run on any web server or web-enabled application
server that provides support for them. Dubbed the JSP engine, this support involves
recognition, translation, and management of the JavaServer Page lifecycle and its
interactions with associated components.
The JSP engine for a particular server might be built-in or might be provided
through a 3rd-party add-on. As long as the server on which you plan to execute the Java
Server Pages supports the same specification level as that to which the file was written,
no changes should be necessary as you move your files from server to server. Note,
however, that instructions for the setup and configuration of the files may differ between
files.
To date, there has been no upwards- or backwards-compatibility between Java
Server Pages specifications. A Java Server Pages file written to the 0.92 specifications
can be run only on a server supporting Java Server Pages 0.92. The same file could not
run on a server supporting only Java Server Pages 1.0 or Java Server Pages 0.91.

Composition
It was mentioned earlier that the Java Server Pages architecture can include
reusable Java components. The architecture also allows for the embedding of a scripting
language directly into the Java Server Pages file.
The components current supported include Java Beans, and Servlets. Support for
Enterprise Java Beans components will likely be added in a future release. As the default
scripting language, Java Server Pages use the Java programming language. This means
that scripting on the server side can take advantage of the full set of capabilities that the
Java programming language offers. Support for other scripting languages might become
available in the future.

29
Processing
A Java Server Pages file is essentially an HTML document with JSP scripting or
tags. It may have associated components in the form of .class, .jar, or .ser files--or it may
not. The use of components is not required.
The Java Server Pages file has a .jsp extension to identify it to the server as a Java
Server Pages file. Before the page is served, the Java Server Pages syntax is parsed and
processed into a servlet on the server side. The servlet that is generated outputs real
content in straight HTML for responding to the client. Because it is standard HTML, the
dynamically generated response looks no different to the client browser than a static
response.

Access Models
A Java Server Pages file may be accessed in at least two different ways:
1. A client request comes directly into a Java Server Page.

In this scenario, suppose the page accesses reusable Java Bean components that perform
particular well-defined computations like accessing a database. The results of the Bean’s
computations, called result sets are stored with in the Bean as properties. The page uses
such Beans to generate dynamic content and present it back to the client.
2. A request comes through a servlet.

30
The servlet generates the dynamic content. To handle the response to the client,
the servlet creates a Bean and stores the dynamic content (sometimes called the result set)
in the Bean. The servlet then invokes a Java Server Page that will present the content
along with the Bean containing the generated from the servlet.
There are two APIs to support this model of request processing using Java Server
Pages. One API facilitates passing context between the invoking servlet and the Java
Server Page. The other API lets the invoking servlet specify which Java Server Page to
use. In both of the above cases, the page could also contain any valid Java code. The
Java Server Pages architecture encourages separation of content from presentation--it
does not mandate it.
How to Choose Between Access Models
With at least two access models, the question naturally arises "When does it make
sense to have a Java Server Page as the front-end to a servlet, as the back-end to a servlet,
or use only the servlet? Here are some possible guidelines:
 If a graphical interface (GUI) is necessary to collect the request data--use a Java
Server Pages file.
 If the request and request parameters are otherwise available to the servlet, but the
results of the servlet processing requires a graphical interface to present them--use
a Java Server Pages file.
 If presentation layout is minimal (will not require very many println lines in your
servlet code) and you don't need to make that presentation logic available to a
customer or your web page designer, then a Servlet might suffice.
WAP
WAP is a protocol, a data transport mechanism. In many ways it is similar to
HTTP (the protocol the web uses for data transport), and was built based on established
standards, such as IP, URLs and XML. Since WAP was designed for wireless computing
it has to accommodate the unique and fundamental limitations of wireless computing

31
Such as:
 Devices with limited processing power and memory
 Limited battery life and power
 Small displays
 Limited data input and user interaction capabilities
 Limited bandwidth and connection speeds
 Frequent unstable connections
WAP Specification
The key components of WAP specification are:

 A programming model based heavily on the existing Web programming


model
 An XML-conforming markup language designed for creating device-
independent WAP applications
 The WMLScript scripting language based on European computer
Manufactures Association ECMAScript language for extending the power
of WML.
 A microbrowser specification that defines how WML and WMLScript
should be interpreted in the handset and presented to the user
 A framework for wireless telephony applications (WTA), providing
functions that carrier can use to integrate the telephone and microbrowser
functions of a WAP device
 A lightweight protocol stack designed to minimize bandwidth
requirements, work with a variety of wireless transports, and provide
secure connections.

32
6. SYSTEM DESIGN
6.1. INPUT DESIGN

The input design is the link between the information system and the user. It
comprises the developing specification and procedures for data preparation and those
steps are necessary to put transaction data in to a usable form for processing can be
achieved by inspecting the computer to read data from a written or printed document or it
can occur by having people keying the data directly into the system. The design of input
focuses on controlling the amount of input required, controlling the errors, avoiding
delay, avoiding extra steps and keeping the process simple. The input is designed in such
a way so that it provides security and ease of use with retaining the privacy. Input Design
considered the following things:

 What data should be given as input?

 How the data should be arranged or coded?

 The dialog to guide the operating personnel in providing input.

 Methods for preparing input validations and steps to follow when error occur.

OBJECTIVES

1. Input Design is the process of converting a user-oriented description of the input into
a computer-based system. This design is important to avoid errors in the data input
process and show the correct direction to the management for getting correct
information from the computerized system.
2. It is achieved by creating user-friendly screens for the data entry to handle large
volume of data. The goal of designing input is to make data entry easier and to be free
from errors. The data entry screen is designed in such a way that all the data
manipulates can be performed. It also provides record viewing facilities.
3. When the data is entered it will check for its validity. Data can be entered with the
help of screens. Appropriate messages are provided as when needed so that the user
will not be in maize of instant. Thus the objective of input design is to create an input
layout that is easy to follow.

33
6.2. OUTPUT DESIGN

A quality output is one, which meets the requirements of the end user and
presents the information clearly. In any system results of processing are communicated to
the users and to other system through outputs. In output design it is determined how the
information is to be displaced for immediate need and also the hard copy output. It is the
most important and direct source information to the user. Efficient and intelligent output
design improves the system’s relationship to help user decision-making.

1. Designing computer output should proceed in an organized, well thought out manner;
the right output must be developed while ensuring that each output element is
designed so that people will find the system can use easily and effectively. When
analysis design computer output, they should Identify the specific output that is
needed to meet the requirements.
2. Select methods for presenting information.
3. Create document, report, or other formats that contain information produced by the
system.

The output form of an information system should accomplish one or more of the
following objectives.

 Convey information about past activities, current status or projections of the

 Future.

 Signal important events, opportunities, problems, or warnings.

 Trigger an action.

 Confirm an action.

34
7. SYSTEM ARCHITECTURE
7.1. SYSTEM ARCHITECTURE

35
7.2. DATA FLOW DIAGRAM

Source node Node B Node C

Node D Node E Node F

Node G Node H

Network (base Station)

Set Cost Value for Every


Nodes & Deplete Non
Functioning Nodes

Destination

36
7.3. UML DIAGRAM

7.3.1. USE CASE DIAGRAM

37
7.3.2. SEQUENCE DIAGRAM

38
7.3.3. ACTIVITY DIAGRAM

39
7.3.4. CLASS DIAGRAM

40
8. SYSTEM IMPLEMENTATION
1) Blacklist:
Each packet carries a blacklist (a minimal set of degraded links encountered along its
path), and the next hop is determined by excluding the blacklisted links. A packet’s
blacklist is initially empty and remains empty when there is no discrepancy between the
current and the advertised states of links along its path. But when a packet arrives at a
node with a degraded link adjacent to its next hop, that link is added to the packet’s
blacklist. The packet is then forwarded to an alternate next hop. The packet’s blacklist is
reset to empty when the next hop makes forward progress, i.e., the next hop has a shorter
path to the destination than any of the nodes traversed by the packet.
2) Multipath Routing
Multipath routing is a promising routing scheme to accommodate these requirements
by using multiple pairs of routes between a source and a destination. Multipath routing is
the routing technique of using multiple alternative paths through a network, which can
yield a variety of benefits such as increased bandwidth, or improved security. The
multiple paths computed might be overlapped, edge-disjointed or node-disjointed with
each other. Extensive research has been done on multipath routing techniques.

3) Directed Diffusion Algorithm


The goal of the DD algorithm is to reduce the data relay transmission counts for
power management. The DD algorithm is a query-driven transmission protocol. The
collected data is transmitted only if it matches the query from the sink node. In the DD
algorithm, the sink node provides the queries in the form of attribute-value pairs to the
other sensor nodes by broadcasting the query packets to the whole network.
Subsequently, the sensor nodes send the data back to the sink node only when it fits the
queries.
4) Grade Diffusion Algorithm
The GD algorithm not only creates the routing for each sensor node but also identifies
a set of neighbor nodes to reduce the transmission loading. Each sensor node can select a
sensor node from the set of neighbor nodes when its grade table lacks a node able to

41
perform the relay. The GD algorithm can also record some information regarding the data
relay. Then, a sensor node can select a node with a lighter loading or more available
energy than the other nodes to perform the extra relay operation. That is, the GD
algorithm updates the routing path in real time, and the event data is thus sent to the sink
node quickly and correctly.
5) Fault Node Recovery
Fault node recovery (FNR) algorithm for WSNs based on the grade diffusion
algorithm combined with the genetic algorithm. The FNR algorithm creates the grade
value, routing table, neighbor nodes, and payload value for each sensor node using the
grade diffusion algorithm. In the FNR algorithm, the number of nonfunctioning sensor
nodes is calculated during the wireless sensor network operation, The sensor nodes
transfer the event data to the sink node according to the GD algorithm when events
appear.
6) Fast Reroute:
Techniques developed for fast recovery from multiple-link failures provide more than
one forwarding edge to route a packet to a destination. Whenever the default forwarding
edge fails or a packet is received from the node attached to the default forwarding edge
for the destination, the packets are rerouted on the backup ports. In the authors present a
framework for IP fast reroute detailing three candidate solutions for IP fast reroute that
have all gained considerable attention. When a forwarding link on a tree fails, the packet
may be switched to the other tree.

42
9. SYSTEM TESTING
System Testing is an important stage in any system development life cycle.
Testing is a process of executing a program with the intention of finding errors. The
importance of software testing and its implications with respect to software quality
cannot be overemphasized. Software testing is a critical element of software quality
assurance and represents the ultimate review of specification, design and coding. A good
test case is one that has a high probability of finding a yet undiscovered error.

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.

Testing is the set of activities that can be planned in advance and


conducted systematically. Different test conditions should be thoroughly checked and the
bugs detected should be fixed. The testing strategies formed by the user are performed to
prove that the software is free and clear from errors. To do this, there are many ways of
testing the system’s reliability, completeness and maintainability.

The important phase of software development is concerned with translating the


design specification into the error-free source code. Testing is carried out to ensure that
the system does not fail, that it meets the specification and it satisfies the user. The
system testing was carried out in a systematic manner with a test data containing all
possible combinations of data to check the features of the system. A test data was
prepared for each module, which took care of all the modules of the program.

System Testing is an important stage where the system developed is tested with
duplicate or original data. It is a process of executing a program with the intent of finding
an error. It is a critical process that can consume fifty percent of the development time.

43
The following are the attributes of good test:
 A good test is not redundant.
 A good test should be "best of breed".
 A good test should be neither simple nor too complex.

9.1. UNIT TESTING

In the unit testing the analyst tests the program making up a system. The software
units in a system are the modules and routines that are assembled and integrated to
perform a specific function. In a large system, many modules on different levels are
needed.

Unit testing can be performed from the bottom up starting with the smallest and
lowest level modules and proceeding one at a time. For each module in a bottom-up
testing, a short program executes the module and provides the needed data.

9.2. INTEGRATION TESTING

Integration testing is a systematic technique for constructing the program structure


while conducting test to uncover errors associate with interfacing. Objectives are used to
take unit test modules and built program structure that has been directed by design.

The integration testing is performed for this project when all the modules where
to make it a complete system. After integration the project works successfully.

9.3. VALIDATION TESTING

Validation testing can be defined in many ways, but a simple definition is that can
be reasonably expected by the customer. After validation test has been conducted, one of
two possible conditions exists.

 The functions or performance characteristics confirm to specification and are


accepted.

 A deviation from specification is uncovered and a deficiency list is created.

Proposed system under consideration has been tested by using validation testing and
found to be working satisfactorily.

44
For example, in this project validation testing is performed against module. This
module is tested with the following valid and invalid inputs for the field id.

9.4. WHITE BOX TESTING

White box testing, sometimes called glass-box testing is a test case design method
that uses the control structure of the procedural design to derive test cases. Using white
box testing methods, the software engineer can derive test cases that

 Guarantee that all independent paths with in a module have been exercised at
least once.

 Exercise all logical decisions on their true and false sides.

 Execute all loops at their boundaries and with in their operational bounds and

 Exercise internal data structure to assure their validity.

For example in this project white box testing is performed against patient
module. Without entering text if we apply it displays the message “First add record then
save it” else it should be saved.

9.5. BLACK BOX TESTING

This method treats the coded module as a black box. The module runs with inputs
that are likely to cause errors. Then the output is checked to see if any error occurred.
This method cannot be used to test all errors, because some errors may depend on the
code or algorithm used to implement the module.

45
10. CONCLUSION
In real wireless sensor networks, the sensor nodes use battery power supplies and thus
have limited energy resources. In addition to the routing, it is important to research the
optimization of sensor node replacement, reducing the replacement cost, and reusing the
most routing paths when some sensor nodes are nonfunctional. This paper proposes a
fault node recovery algorithm for WSN based on the grade diffusion algorithm combined
with a genetic algorithm. The FNR algorithm requires replacing fewer sensor nodes and
reuses the most routing paths, increasing the WSN lifetime and reducing the replacement
cost. In the simulation, the proposed algorithm increases the number of active nodes up to
8.7 times. The number of active nodes is enhanced 3.16 times on average after replacing
an average of 32 sensor nodes for each calculation. The algorithm reduces the rate of data
loss by approximately 98.8% and reduces the rate of energy consumption by
approximately 31.1%. Therefore, the FNR algorithm not only replaces sensor nodes, but
also reduces the replacement cost and reuses the most routing paths to increase the WSN
lifetime.

FUTURE ENHANCEMENT

Our plan is to implement a prototype of LOLS using Mini net to demonstrate it’s
deploy ability. We can evaluate the overhead due to LOLS using several large real
topologies and shown that it scales better than the recently proposed scheme FCP which
has similar failure resilience objectives.

46
APPENDIX -1.1
SCREENSHOTS

SCREEN LAYOUT
Node A

47
Node B

48
Node C

49
Node D

50
Node E

51
Node F

52
Node G

53
Node H

54
Node I

55
Network

56
Set Cost Values in Network Simulation

57
Node A with File Selection and Path Selection

58
Network After detecting fault and failure nodes

59
Node A after Sending Packets

60
Node B with received packets

61
Node E with received packets

62
Node F with received packets

63
Node I (Destination) after receiving the packets from Node A (Source)

64
Network after sending the packets to destination node

65
APPENDIX -1.2
CODINGS

Network:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;
import java.util.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import javax.swing.border.LineBorder;

class networkwin extends JFrame implements ActionListener


{

String [] val =new String[24];


String [] pat =new String[24];
String [] pat1 =new String[24];

//---

java.util.Date d = new java.util.Date();


String str=d.toString();
String array[]=str.split(" ");

66
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

//---
private JPanel contentPane;
//-----

private JPanel jPanel1;


//-----
private JPanel jPanel2;
//-----
private JPanel jPanel3;
//--

JTextArea fl1=new JTextArea();

JButton cvs;
JLabel tit,titb;
// JLabel title = new JLabel("<html><font color=#000000 size=+2><strong>Cut
Detection in Wireless Sensor Networks</strong></font></html>");

JLabel fl =new JLabel("<html><font color=#000000 size=3><strong>Failure


Links:</strong></font></html>");
JLabel source =new JLabel("<html><font color=#000000
size=3><strong>Source Node :</strong></font></html>");
JLabel destination =new JLabel("<html><font color=#000000
size=3><strong>Destination Node :</strong></font></html>");
JLabel srcn =new JLabel("<html><font color=#ff0000 size=3><strong>Node
A </strong></font></html>");
JLabel desn =new JLabel("<html><font color=#ff0000 size=3><strong>Node I
</strong></font></html>");

JLabel cv =new JLabel("<html><font color=#ff0000 size=4><strong>Enter


Cost Values :</strong></font></html>");
// JLabel non2 =new JLabel(non1);
// JLabel nol2 =new JLabel(nol1);

JLabel na = new JLabel("A");


JLabel nb = new JLabel("B");
JLabel nc = new JLabel("C");

67
JLabel nd = new JLabel("D");
JLabel ne = new JLabel("E");
JLabel nf = new JLabel("F");
JLabel ng = new JLabel("G");
JLabel nh = new JLabel("H");
JLabel ni = new JLabel("I");

JLabel nodeA = new JLabel();


JLabel nodeB = new JLabel();
JLabel nodeC = new JLabel();

JLabel nodeD = new JLabel();


JLabel nodeE = new JLabel();
JLabel nodeF = new JLabel();
JLabel nodeG = new JLabel();
JLabel nodeH = new JLabel();
JLabel nodeI= new JLabel();

JLabel ab = new JLabel();


JLabel bc = new JLabel();
JLabel ad = new JLabel();
JLabel be = new JLabel();
JLabel cf = new JLabel();
JLabel de = new JLabel();
JLabel ef = new JLabel();
JLabel dg = new JLabel();
JLabel eh = new JLabel();
JLabel fi = new JLabel();
JLabel gh = new JLabel();
JLabel hi = new JLabel();

JLabel ae = new JLabel();


JLabel ce = new JLabel();
JLabel ge = new JLabel();
JLabel ie = new JLabel();

ImageIcon vv = new ImageIcon(this.getClass().getResource("g.png"));


ImageIcon ver1 = new ImageIcon(this.getClass().getResource("a.png"));
ImageIcon hor1 = new ImageIcon(this.getClass().getResource("b.png"));

68
//---- cost values label & textfield

JLabel cab = new JLabel("A -- B :");


JLabel cbc = new JLabel("B -- C :");
JLabel cde = new JLabel("D -- E :");
JLabel cef = new JLabel("E -- F :");
JLabel cgh = new JLabel("G -- H :");
JLabel chi = new JLabel("H -- I :");

JLabel cad = new JLabel("A -- D :");


JLabel cbe = new JLabel("B -- E :");
JLabel ccf = new JLabel("C -- F :");
JLabel cdg = new JLabel("D -- G :");
JLabel ceh = new JLabel("E -- H :");
JLabel cfi = new JLabel("F -- I :");

JTextField cab1=new JTextField();


JTextField cbc1=new JTextField();
JTextField cde1=new JTextField();
JTextField cef1=new JTextField();
JTextField cgh1=new JTextField();
JTextField chi1=new JTextField();
JTextField cad1=new JTextField();
JTextField cbe1=new JTextField();
JTextField ccf1=new JTextField();
JTextField cdg1=new JTextField();
JTextField ceh1=new JTextField();
JTextField cfi1=new JTextField();

//-----
// End of variables declaration

public networkwin()
{
super();

69
initializeComponent();
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
* to retrieve your design properly in future, before revising this
method.
*/
private void initializeComponent()
{

contentPane = (JPanel)this.getContentPane();
//-----

Border thickBorder = new LineBorder(Color.WHITE, 2);

titb=new JLabel();
TitledBorder titled = new TitledBorder("NetWork Monitor");

titb.setBorder(thickBorder);

cvs = new JButton("submit");


cvs.addActionListener(this);
cvs.setBorder(BorderFactory.createRaisedBevelBorder());
cvs.setBackground(new Color(254,155,54));

jPanel1 = new JPanel();


jPanel1.setBackground(new Color(84,220,238));
//-----

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(84,220,238));

jPanel3 = new JPanel();


jPanel3.setBackground(new Color(84,220,238));

70
//--

tit= new JLabel();


ImageIcon s1 = new
ImageIcon(this.getClass().getResource("header1.jpg"));
tit.setIcon(s1);

//--

//--
nodeA.setIcon(vv);
nodeB.setIcon(vv);
nodeC.setIcon(vv);
nodeD.setIcon(vv);
nodeE.setIcon(vv);
nodeF.setIcon(vv);
nodeG.setIcon(vv);
nodeH.setIcon(vv);
nodeI.setIcon(vv);

//---

ab.setIcon(hor1);
bc.setIcon(hor1);

de.setIcon(hor1);
ef.setIcon(hor1);

gh.setIcon(hor1);
hi.setIcon(hor1);

//----
ad.setIcon(ver1);
be.setIcon(ver1);
cf.setIcon(ver1);

dg.setIcon(ver1);
eh.setIcon(ver1);
fi.setIcon(ver1);

//---

71
//---

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

addComponent(contentPane, nodeA, 75,160,30,30);


addComponent(contentPane, nodeB, 255,160,30,30);
addComponent(contentPane, nodeC, 435,160,30,30);
addComponent(contentPane, nodeD, 75,290,30,30);
addComponent(contentPane, nodeE, 255,290,30,30);
addComponent(contentPane, nodeF, 435,290,30,30);
addComponent(contentPane, nodeG, 75,420,30,30);
addComponent(contentPane, nodeH, 255,420,30,30);
addComponent(contentPane, nodeI, 435,420,30,30);

addComponent(contentPane, na, 115,190,10,10);


addComponent(contentPane, nb, 295,190,90,30);
addComponent(contentPane, nc, 475,190,90,30);
addComponent(contentPane, nd, 115,320,90,30);
addComponent(contentPane, ne, 295,320,90,30);
addComponent(contentPane, nf, 475,320,90,30);
addComponent(contentPane, ng, 115,450,90,30);
addComponent(contentPane, nh, 295,450,90,30);
addComponent(contentPane, ni, 475,450,90,30);

//--horizontal lines
addComponent(contentPane, ab, 85,170,150,30);
addComponent(contentPane, de, 85,300,150,30);
addComponent(contentPane, gh, 85,430,150,30);

addComponent(contentPane, bc, 265,170,150,30);


addComponent(contentPane, ef, 265,300,150,30);
addComponent(contentPane, hi, 265,430,150,30);
//--vertical lines

addComponent(contentPane, ad, 75,200,30,80);


addComponent(contentPane, be, 255,200,30,80);
addComponent(contentPane, cf, 435,200,30,80);

addComponent(contentPane, dg, 75,330,30,80);


addComponent(contentPane, eh, 255,330,30,80);
addComponent(contentPane, fi, 435,330,30,80);

72
//----cost values

addComponent(contentPane, cv, 70,470,150,30);


addComponent(contentPane, cab, 70,510,100,30);
addComponent(contentPane, cbc, 70,560,100,30);
addComponent(contentPane, cde, 70,610,100,30);
addComponent(contentPane, cef, 250,510,100,30);
addComponent(contentPane, cgh, 250,560,100,30);
addComponent(contentPane, chi, 250,610,100,30);

addComponent(contentPane, cab1, 130,515,75,25);


addComponent(contentPane, cbc1, 130,565,75,25);
addComponent(contentPane, cde1, 130,615,75,25);
addComponent(contentPane, cef1, 310,515,75,25);
addComponent(contentPane, cgh1, 310,565,75,25);
addComponent(contentPane, chi1, 310,615,75,25);

addComponent(contentPane, cad, 430,510,100,30);


addComponent(contentPane, cbe, 430,560,100,30);
addComponent(contentPane, ccf, 430,610,100,30);
addComponent(contentPane, cdg, 600,510,100,30);
addComponent(contentPane, ceh, 600,560,100,30);
addComponent(contentPane, cfi, 600,610,100,30);

addComponent(contentPane, cad1, 490,515,75,25);


addComponent(contentPane, cbe1, 490,565,75,25);
addComponent(contentPane, ccf1, 490,615,75,25);
addComponent(contentPane, cdg1, 660,515,75,25);
addComponent(contentPane, ceh1, 660,565,75,25);
addComponent(contentPane, cfi1, 660,615,75,25);

addComponent(contentPane, cvs, 780,555,75,30);

//--

//----
addComponent(contentPane, source, 580,205,150,30);
addComponent(contentPane, destination, 580,280,150,30);
addComponent(contentPane, srcn, 730,205,150,30);
addComponent(contentPane, desn, 730,280,150,30);

73
addComponent(contentPane, fl,580,355,150,30);
addComponent(contentPane, fl1,720,355,120,70);

//----

addComponent(contentPane, titb, 520,160,370,300);

addComponent(contentPane, jPanel3, 520,160,330,450);

addComponent(contentPane, jPanel1, 6,6,930,100);

addComponent(contentPane, jPanel2, 6,112,930,550);

addComponent(jPanel1, tit, 0,0,930,100);


//
// networkwin
//
this.setTitle("network");
this.setLocation(new Point(35, 10));
this.setSize(new Dimension(950, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}

public void actionPerformed(ActionEvent ae)

{
if(ae.getSource()==cvs)
{

String ab=cab1.getText();
String bc=cbc1.getText();
String de=cde1.getText();
String ef=cef1.getText();
String gh=cgh1.getText();
String hi=chi1.getText();
String ad=cad1.getText();
String be=cbe1.getText();
String cf=ccf1.getText();
String dg=cdg1.getText();
String eh=ceh1.getText();
String fi=cfi1.getText();

74
if((ab.equals("")) || (bc.equals("")) || (de.equals("")) || (ef.equals("")) ||
(gh.equals("")) || (hi.equals("")) || (ad.equals("")) || (be.equals("")) || (cf.equals("")) ||
(dg.equals("")) || (eh.equals("")) || (fi.equals("")))
{
JOptionPane.showMessageDialog(null,"Enter Cost
Values");
}
else
{

val[0]=ab;
val[1]=bc;
val[2]=de;
val[3]=ef;
val[4]=gh;
val[5]=hi;
val[6]=ad;
val[7]=be;
val[8]=cf;
val[9]=dg;
val[10]=eh;
val[11]=fi;
val[12]=ab;
val[13]=bc;
val[14]=de;
val[15]=ef;
val[16]=gh;
val[17]=hi;
val[18]=ad;
val[19]=be;
val[20]=cf;
val[21]=dg;
val[22]=eh;
val[23]=fi;

pat[0]="ab";
pat[1]="bc";
pat[2]="de";
pat[3]="ef";
pat[4]="gh";
pat[5]="hi";
pat[6]="ad";
pat[7]="be";
pat[8]="cf";
pat[9]="dg";

75
pat[10]="eh";
pat[11]="fi";
pat[12]="ba";
pat[13]="cb";
pat[14]="ed";
pat[15]="fe";
pat[16]="hg";
pat[17]="ih";
pat[18]="da";
pat[19]="eb";
pat[20]="fc";
pat[21]="gd";
pat[22]="he";
pat[23]="if";

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:lols");

Statement st=con.createStatement();

for(int i=0;i<val.length;i++)
{
String ii=val[i].toString();
String aa=pat[i].toString();

String sql="update cost set val='"+ii+"' where path='"+aa+"'";


st.executeUpdate(sql);
}

JOptionPane.showMessageDialog(null,"Cost Values are Stored");

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

76
}

/** 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);
}

public class network extends UnicastRemoteObject implements srvint


{
static networkwin cpw=new networkwin();
Random r;

String [] pat1=new String[24];

//cpw.non.setText("9");
//cpw.nol.setText("12");
ImageIcon hr = new ImageIcon(this.getClass().getResource("b1.png"));
ImageIcon hg = new ImageIcon(this.getClass().getResource("b.png"));

ImageIcon vr = new ImageIcon(this.getClass().getResource("a1.png"));


ImageIcon vg = new ImageIcon(this.getClass().getResource("a.png"));

String [] path;

public network() throws RemoteException


{
pat1[0]="ab";

77
pat1[1]="bc";
pat1[2]="de";
pat1[3]="ef";
pat1[4]="gh";
pat1[5]="hi";
pat1[6]="ad";
pat1[7]="be";
pat1[8]="cf";
pat1[9]="dg";
pat1[10]="eh";
pat1[11]="fi";
pat1[12]="ba";
pat1[13]="cb";
pat1[14]="ed";
pat1[15]="fe";
pat1[16]="hg";
pat1[17]="ih";
pat1[18]="da";
pat1[19]="eb";
pat1[20]="fc";
pat1[21]="gd";
pat1[22]="he";
pat1[23]="if";
}

public void reset()


{

cpw.fl1.setText("");

cpw.ab.setIcon(hg);
cpw.bc.setIcon(hg);

cpw.de.setIcon(hg);
cpw.ef.setIcon(hg);

cpw.gh.setIcon(hg);
cpw.hi.setIcon(hg);

//----
cpw.ad.setIcon(vg);
cpw.be.setIcon(vg);
cpw.cf.setIcon(vg);

78
cpw.dg.setIcon(vg);
cpw.eh.setIcon(vg);
cpw.fi.setIcon(vg);
}

public void getfile(String [] path,int l,String [] file)


{

public String [] path(String a) throws RemoteException


{
reset();

String [] fpat=new String [3];

r=new Random();

int fp1=r.nextInt(5);
int fp2=r.nextInt(5);
int fp3=r.nextInt(2);

if(fp1==fp2)
{
fp2=r.nextInt(5);
}

//------ hori failure links

if(fp1==0)
{
cpw.ab.setIcon(hr);
// cpw.fl1.append("\n");
cpw.fl1.append("a ---> b");
fpat[0]="ab";

}
if(fp1==1)
{
cpw.bc.setIcon(hr);

79
cpw.fl1.append("\n");
cpw.fl1.append("b ---> c");
fpat[0]="bc";

}
if(fp1==2)
{
cpw.de.setIcon(hr);
cpw.fl1.append("\n");
cpw.fl1.append("d ---> e");
fpat[0]="de";
}
if(fp1==3)
{
cpw.ef.setIcon(hr);
cpw.fl1.append("\n");
cpw.fl1.append("e ---> f");
fpat[0]="ef";
}
if(fp1==4)
{
cpw.gh.setIcon(hr);
cpw.fl1.append("\n");
cpw.fl1.append("g ---> h");
fpat[0]="gh";
}

if(fp3==0)
{
cpw.hi.setIcon(hr);
cpw.fl1.append("\n");
cpw.fl1.append("h ---> i");
fpat[2]="hi";
}

//------ ver failure links

if(fp2==0)
{
cpw.ad.setIcon(vr);
cpw.fl1.append("\n");
cpw.fl1.append("a ---> d");
fpat[1]="ad";
}

80
if(fp2==1)
{
cpw.be.setIcon(vr);
cpw.fl1.append("\n");
cpw.fl1.append("b ---> e");
fpat[1]="be";
}
if(fp2==2)
{
cpw.cf.setIcon(vr);
cpw.fl1.append("\n");
cpw.fl1.append("c ---> f");
fpat[1]="cf";
}
if(fp2==3)
{
cpw.dg.setIcon(vr);
cpw.fl1.append("\n");
cpw.fl1.append("d ---> g");
fpat[1]="dg";
}
if(fp2==4)
{
cpw.eh.setIcon(vr);
cpw.fl1.append("\n");
cpw.fl1.append("e ---> h");
fpat[1]="eh";
}

if(fp3==1)
{
cpw.fi.setIcon(vr);
cpw.fl1.append("\n");
cpw.fl1.append("f ---> i");
fpat[2]="fi";
}

return fpat;

public String sendpath(String[] pat)throws RemoteException


{

81
double [] val=new double[(int)pat.length];

for(int y=0;y<pat.length;y++)
{
int va=0;
String v=pat[y].toString().replace("--->","");

for(int t=0;t<pat1.length;t++)
{
String path11=pat1[t].toString();

if(v.indexOf(pat1[t]) > -1 )
{

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:lols");

Statement st=con.createStatement();
String sql="select * from cost where path='"+path11+"' ";
ResultSet rs= st.executeQuery(sql);
while(rs.next())
{
String vv=rs.getString("val");
int va1=Integer.parseInt(vv);
va=va1+va;

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

}
double d=(double)va;

82
val[y] =d;

int po=minIndex(val);

String sp=pat[po].toString();
System.out.println(sp);

return sp;
}

public int minIndex(double [] ds) {


int idx = -1;
double d= Double.POSITIVE_INFINITY;
for(int i = 0; i < ds.length; i++)
if(ds[i] < d) {
d = ds[i];
idx = i;
}
return idx;
}

public double [] perform(String[] pat)throws RemoteException


{

double [] val=new double[(int)pat.length];

for(int y=0;y<pat.length;y++)
{
int va=0;
String v=pat[y].toString().replace("--->","");

for(int t=0;t<pat1.length;t++)
{
String path11=pat1[t].toString();

if(v.indexOf(pat1[t]) > -1 )
{

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

83
Connection con = DriverManager.getConnection("jdbc:odbc:lols");

Statement st=con.createStatement();
String sql="select * from cost where path='"+path11+"' ";
ResultSet rs= st.executeQuery(sql);
while(rs.next())
{
String vv=rs.getString("val");
int va1=Integer.parseInt(vv);
va=va1+va;

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

}
double d=(double)va;
val[y] =d;
System.out.println(d);

return val;
}

public void getfile(String ipath,String ifile,String[] s,String[] p,String sname)


{
}
public void pack(int i,String s) throws RemoteException
{
}

84
public void simulate(String s) throws RemoteException
{

System.out.println(s);
try{

delay d=new delay();

if(s.equals("ab"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.ab.setVisible(false);

}
else
{
cpw.ab.setVisible(true);

cpw.ab.setVisible(true);

if(s.equals("bc"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.bc.setVisible(false);

85
}
else
{
cpw.bc.setVisible(true);

cpw.bc.setVisible(true);

}
if(s.equals("de"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.de.setVisible(false);

}
else
{
cpw.de.setVisible(true);

cpw.de.setVisible(true);

}
if(s.equals("ef"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);

86
if(t%2==0)
{
cpw.ef.setVisible(false);

}
else
{
cpw.ef.setVisible(true);

cpw.ef.setVisible(true);

}
if(s.equals("gh"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.gh.setVisible(false);

}
else
{
cpw.gh.setVisible(true);

cpw.gh.setVisible(true);

}
if(s.equals("hi"))
{

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

87
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.hi.setVisible(false);

}
else
{
cpw.hi.setVisible(true);

cpw.hi.setVisible(true);

}
if(s.equals("ad"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.ad.setVisible(false);

}
else
{
cpw.ad.setVisible(true);

cpw.ad.setVisible(true);

}
if(s.equals("be"))
{

88
for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.be.setVisible(false);

}
else
{
cpw.be.setVisible(true);

cpw.be.setVisible(true);

}
if(s.equals("cf"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.cf.setVisible(false);

}
else
{
cpw.cf.setVisible(true);

cpw.cf.setVisible(true);

89
}
if(s.equals("dg"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.dg.setVisible(false);

}
else
{
cpw.dg.setVisible(true);

cpw.dg.setVisible(true);

}
if(s.equals("eh"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.eh.setVisible(false);

}
else
{
cpw.eh.setVisible(true);

90
}

cpw.eh.setVisible(true);

}
if(s.equals("fi"))
{

for(int i=0;i<30;i++)
{
int t=d.delay1(i);
if(t%2==0)
{
cpw.fi.setVisible(false);

}
else
{
cpw.fi.setVisible(true);

cpw.fi.setVisible(true);

}
catch(Exception e)
{
}

public static void main(String args[])


{
try
{

network c1=new network();

91
Naming.rebind("network",c1);

}catch(Exception e){}

class delay extends Thread

public int delay1(int s)


{
try
{
Thread.sleep(700);
// System.out.println(s);
}
catch(Exception ee)
{
}
return s;
}

Node A:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

92
import java.lang.*;
import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;
import java.lang.*;
import java.util.*;
import javax.swing.text.*;

class nodeAwin extends JFrame implements ActionListener


{
//---
private JPanel contentPane;
//-----
private JPanel jPanel1;
//-----
private JPanel jPanel2;
//-----
File f1;
JLabel file,des;
JTextField file1;
JButton open,path,send,perform;
JTextArea des1;
JTextArea path1;
JTextArea packet1;

JScrollPane path11;

String st;

String ifile;
String s=null;
String fail1;
int v=1;
int i=0,num=0;
byte b1[];
FileInputStream fis;
File f;
String[] pmes;
Random r;
String filesel;

93
String fail;
String [] spath1;

String [] fpath=new String [3];

String [] allp=new String [11];

String spath;

JLabel tit,titb,titr;
JLabel title = new JLabel("<html><font color=#ffffff size=+1><strong>Handling
Multiple Failures in IP Networks through Localized On-Demand Link State
Routing</strong></font></html>");

//-----
// End of variables declaration

public nodeAwin()
{
super();
initializeComponent();
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
* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent()
{
contentPane = (JPanel)this.getContentPane();
//-----

JLabel image= new JLabel();

94
ImageIcon nn = new ImageIcon(this.getClass().getResource("bg3.png"));
image.setIcon(nn);

titb=new JLabel();
TitledBorder titled = new TitledBorder("SENDER");
titb.setBorder(titled);

titr=new JLabel();
TitledBorder titledr = new TitledBorder("Packet Flow");
titr.setBorder(titledr);

//----

//--
file=new JLabel("<html><font color=#FFFFFF
size=+1><strong>File</strong></font>");
des=new JLabel("<html><font color=#FFFFFF
size=+1><strong>Destination</strong></font>");

//--

file1=new JTextField(10);

//---

jPanel1 = new JPanel();


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

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(255,102,102));

//--
open = new JButton("open");
open.addActionListener(this);
open.setBorder(BorderFactory.createRaisedBevelBorder());
open.setBackground(new Color(254,155,54));

path = new JButton("path");


path.addActionListener(this);

95
path.setBorder(BorderFactory.createRaisedBevelBorder());
path.setBackground(new Color(254,155,54));

send = new JButton("send");


send.addActionListener(this);
send.setBorder(BorderFactory.createRaisedBevelBorder());
send.setBackground(new Color(254,155,54));

perform = new JButton("performance");


perform.addActionListener(this);
perform.setBorder(BorderFactory.createRaisedBevelBorder());
perform.setBackground(new Color(254,155,54));

//---
des1=new JTextArea(" Node I");

//--
path1=new JTextArea();
path11=new JScrollPane(path1);

//--
packet1=new JTextArea();

//--

//--

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

//----

addComponent(contentPane, file, 530,225,100,30);


addComponent(contentPane, file1, 660,225,125,20);
addComponent(contentPane, open, 685,275,75,20);
addComponent(contentPane,des, 530,325,100,30);

96
addComponent(contentPane,des1, 660,325,125,20);
addComponent(contentPane,path, 685,375,75,20);
addComponent(contentPane,path11, 530,425,275,100);
addComponent(contentPane,send,715,555,75,20);
addComponent(contentPane,perform,540,555,100,20);
addComponent(contentPane,image,120,155,243,150);

addComponent(contentPane,packet1,150,400,150,200);

addComponent(contentPane, title, 70,45,850,30);


addComponent(contentPane, titb, 470,180,400,425);
addComponent(contentPane, titr, 125,370,200,250);

addComponent(contentPane, jPanel1, 6,6,930,106);

addComponent(contentPane, jPanel2, 6,113,930,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeAwin
//
this.setTitle("nodeA");
this.setLocation(new Point(35, 10));
this.setSize(new Dimension(950, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}

public void actionPerformed(ActionEvent ae)

{
StringBuffer sb=new StringBuffer();

// -- send file
if(ae.getSource()==send)
{

if(file1.getText().equals(""))

97
{

JOptionPane.showMessageDialog(null,"Browse File");

file1.requestFocus();
}
else if(path1.getText().equals(""))
{

JOptionPane.showMessageDialog(null,"select path");

file1.requestFocus();
}

else
{
String gp=path1.getText().trim();

String [] gp1=gp.split("\n");
try
{

String url="rmi://127.0.0.1/network";
srvint in=(srvint)Naming.lookup(url);

String pathh=in.sendpath(gp1);

pathh=pathh.replace("--->","");

String [] spa=new String [(int)pathh.length()];


int spl=spa.length;

for(int i=0;i<spa.length;i++)
{
spa[i]=Character.toString(pathh.charAt(i));

//----send file

98
f=new File(filesel);

int sz,sz1;
byte[] buffer;

pmes=new String[7];

FileInputStream fin=new FileInputStream(filesel);


sz=fin.available()/7;
buffer=new byte[sz];

//---

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

fin.read(buffer);
st=new String(buffer);
pmes[i]=st;

int l=0;

new client1(spa,l,pmes);
new client11(spa,l);

catch(Exception e1)
{
System.out.println(e1);
}

99
}

//--performance
if(ae.getSource()==perform)
{

String gp=path1.getText().trim();
String [] gp1=gp.split("\n");
try
{
String url="rmi://localhost/network";
srvint in=(srvint)Naming.lookup(url);

double [] value=in.perform(gp1);

for(int y=0;y<gp1.length;y++)
{
StringBuffer ss=new StringBuffer(gp1[y]);
ss.append("
( ").append(Double.toString(value[y])).append(" )");
gp1[y]=new String(ss);
}

for(int t=0;t<value.length;t++)
{
value[t]=(100-value[t]);
}

new bar(value,gp1,"Performance Chart");

}
catch(Exception ee)
{
}

100
}

//-- open file


if(ae.getSource()==open)

FileDialog fd1=new FileDialog(this,"OPEN",FileDialog.LOAD);


fd1.setVisible(true);
filesel=fd1.getDirectory()+fd1.getFile();
file1.setText(filesel);

if(ae.getSource()==path)
{
String rp=null;
String rp1=null;
String rp2=null;

path1.setText("");

allp[0]="a--->b--->c--->f--->i";
allp[1]="a--->b--->e--->f--->i";
allp[2]="a--->b--->e--->h--->i";
allp[3]="a--->b--->c--->f--->e--->h--->i";
allp[4]="a--->b--->c--->f--->e--->d--->g--->h--->i";
allp[5]="a--->b--->e--->d--->g--->h--->i";
allp[6]="a--->d--->g--->h--->i";
allp[7]="a--->d--->e--->b--->c--->f--->i";
allp[8]="a--->d--->e--->f--->i";
allp[9]="a--->d--->g--->h--->e--->b--->c--->f--->i";
allp[10]="a--->d--->e--->h--->i";

try
{
String s="rmi://localhost/network";
srvint in=(srvint)Naming.lookup(s);

101
fpath=in.path("hai");

for(int i=fpath[0].length() -1;0 <=i;i--)


{
rp =rp+fpath[0].charAt(i);
rp=rp.replace("null","").trim();
}
for(int i=fpath[1].length() -1;0 <=i;i--)
{
rp1 =rp1+fpath[1].charAt(i);
rp1=rp1.replace("null","").trim();
}
for(int i=fpath[2].length() -1;0 <=i;i--)
{
rp2 =rp2+fpath[2].charAt(i);
rp2=rp2.replace("null","").trim();
}

System.out.println("*************************");
System.out.println(rp.trim());
System.out.println(rp1.trim());
System.out.println(rp2.trim());

for(int j=0;j<allp.length;j++)
{
String fp=allp[j];
fp=fp.replace("--->","");

if ((fp.indexOf(fpath[0]) > -1 ) || (fp.indexOf(fpath[1]) > -1 ) ||


(fp.indexOf(fpath[2]) > -1 ) || (fp.indexOf(rp) > -1 ) || (fp.indexOf(rp1) > -1 ) ||
(fp.indexOf(rp2) > -1 ))
{

System.out.println("impossible:"+allp[j]);
}
else
{
path1.append("\n");
path1.append(allp[j]);
System.out.println("possible:"+allp[j]);
}

102
}

}
catch(Exception e){}

}
}

/** 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);
}

public class nodeA extends UnicastRemoteObject implements srvint


{

nodeAwin gp1c1=new nodeAwin();


srvint gi3;
String [] s=new String [5];

public nodeA()throws RemoteException


{
}

public void simulate(String s) throws RemoteException


{
}
public void getfile(String [] path,int l,String [] file)
{

}
public void pack(int i,String name) throws RemoteException
{

103
gp1c1.packet1.append("Packet["+i+"]:Sent");
gp1c1.packet1.append("\n");

try
{
Thread.sleep(1500);

}catch(Exception e){}

public double [] perform(String [] p) throws RemoteException


{
double [] d =new double [5];

return d;
}
public String sendpath(String [] p) throws RemoteException
{

return "dasd";
}

public void failnode(String fno,String src,String des)throws RemoteException


{

}
public String [] path(String a)throws RemoteException
{
String [] sss = new String [3];

return sss;
}

public static void main(String args[])


{
try
{

nodeA c1=new nodeA();

104
Naming.rebind("a",c1);

}catch(Exception e){}

class client1 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;
String [] path;
String s1,s2;

Thread t;

client1(String [] spat,int spl,String[] pa)


{

this.pmes=pa;
this.path=spat;
this.l=spl;

t=new Thread(this,"cc1");
t.start();

public void run()


{
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);

105
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}

catch(Exception e){}

class client11 extends Thread


{

Thread t;
String [] path;
int l;

client11(String [] pat,int len)


{
this.path=pat;
this.l=len;
t=new Thread(this,"cc11");
t.start();

public void run()


{

l=l+1;

String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("a"+path[l]);
t.sleep(2500);
}
catch(Exception e){}

106
}

Node B:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import java.lang.*;
import java.util.*;

class nodeBwin extends JFrame implements ActionListener


{
//---

java.util.Date d = new java.util.Date();


String str=d.toString();
String array[]=str.split(" ");
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

107
//---
private JPanel contentPane;
//-----

private JPanel jPanel1;


//-----
private JPanel jPanel2;
//-----

JLabel tit0,tit1,tit2;

JLabel title = new JLabel("<html><font color=#ffffff size=+2><strong>Handling


Multiple Failures in IP Networks through Localized</strong></font></html>");
JLabel title1 = new JLabel("<html><font color=#ffffff size=+2><strong> On-Demand
Link State Routing</strong></font></html>");

//--
JTextArea des0,des1,des2;
JButton reset;

//-----
// End of variables declaration

public nodeBwin()
{
super();
initializeComponent();
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
* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent()
{
contentPane = (JPanel)this.getContentPane();

108
//-----

JLabel image= new JLabel();


ImageIcon nn = new ImageIcon(this.getClass().getResource("bg.png"));
image.setIcon(nn);

tit0=new JLabel();
TitledBorder titled0 = new TitledBorder("Node A");
tit0.setBorder(titled0);

tit1=new JLabel();
TitledBorder titled1 = new TitledBorder("Node C");
tit1.setBorder(titled1);

//----

tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node E");
tit2.setBorder(titled2);

//---

jPanel1 = new JPanel();


jPanel1.setBackground(new Color(0,100,0));

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(124,205,124));

reset = new JButton("Reset");


reset.addActionListener(this);
reset.setBorder(BorderFactory.createRaisedBevelBorder());
reset.setBackground(new Color(254,155,54));

//--
des0 =new JTextArea();
des1 =new JTextArea();
des2 =new JTextArea();

//--

contentPane.setLayout(null);

109
//contentPane.setBackground(new Color());

//----

addComponent(contentPane, title, 60,25,750,30);


addComponent(contentPane, title1, 200,65,750,30);
addComponent(contentPane, tit0, 50,350,225,250);
addComponent(contentPane, tit1, 300,350,225,250);
addComponent(contentPane, tit2, 555,350,225,250);

addComponent(contentPane, des0, 90,380,145,200);


addComponent(contentPane, des1, 340,380,145,200);
addComponent(contentPane, des2, 600,380,145,200);
addComponent(contentPane, reset, 375,625,100,25);

addComponent(contentPane, image, 250,85,350,300);

addComponent(contentPane, jPanel1, 6,6,800,106);


addComponent(contentPane, jPanel2, 6,113,800,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeBwin
//
this.setTitle("nodeB");
this.setLocation(new Point(75, 10));
this.setSize(new Dimension(820, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}

public void actionPerformed(ActionEvent ae)

if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");

110
des2.setText("");

/** 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);
}

public class nodeB extends UnicastRemoteObject implements srvint


{

nodeBwin gp1c2=new nodeBwin();


srvint gi3;

public nodeB()throws RemoteException


{
}
public void simulate(String s) throws RemoteException
{
}

public void getfile(String [] path,int l,String [] file)


{
try
{

String ms,gs3;

String p=path[l-1];

if(p.equals("a"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

111
for(int i=0;i<7;i++)
{

if(file[i] !=null)
{
gp1c2.des0.append("\n");
gp1c2.des0.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
}
else if(p.equals("c"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des1.append("\n");
gp1c2.des1.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

112
}

}
else if(p.equals("e"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des2.append("\n");
gp1c2.des2.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

new client2(path,l,file);
new client22(path,l);
}
catch(Exception e){}

113
}
public double [] perform(String [] p) throws RemoteException
{
double [] d =new double [5];

return d;
}
public String [] path(String a)throws RemoteException
{
String [] sss = new String [3];

return sss;
}
public String sendpath(String [] p) throws RemoteException
{

return "dasd";
}
public void pack(int i,String name) throws RemoteException
{

if(name.equals("c"))
{

gp1c2.des1.append("Packet["+i+"]:Sent");
gp1c2.des1.append("\n");
}
else if(name.equals("e"))
{

gp1c2.des2.append("Packet["+i+"]:Sent");
gp1c2.des2.append("\n");
}

try
{
Thread.sleep(1500);

}catch(Exception e){}

114
}
public static void main(String args[])
{
try
{

nodeB c1=new nodeB();


Naming.rebind("b",c1);

}catch(Exception e){}

class client2 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;
String [] path;
String s1,s2;

Thread t;

client2(String [] spat,int spl,String[] pa)


{

this.pmes=pa;
this.path=spat;
this.l=spl;

t=new Thread(this,"cc2");
t.start();

115
}

public void run()


{
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}

catch(Exception e){}

class client22 extends Thread


{

Thread t;
String [] path;
int l;

client22(String [] pat,int len)


{
this.path=pat;
this.l=len;
t=new Thread(this,"cc22");
t.start();

116
public void run()
{

l=l+1;

String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("b"+path[l]);
t.sleep(2500);
}
catch(Exception e){}

Node C:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;

117
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import java.lang.*;
import java.util.*;

class nodeCwin extends JFrame implements ActionListener


{
//---

java.util.Date d = new java.util.Date();


String str=d.toString();
String array[]=str.split(" ");
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

//---
private JPanel contentPane;
//-----

private JPanel jPanel1;


//-----
private JPanel jPanel2;
//-----

JLabel tit1,tit2;
JLabel title = new JLabel("<html><font color=#ffffff size=+2><strong>Handling
Multiple Failures in IP Networks through Localized</strong></font></html>");
JLabel title1 = new JLabel("<html><font color=#ffffff size=+2><strong> On-
Demand Link State Routing</strong></font></html>");
//--
JTextArea des1,des2;
JButton reset;

//-----
// End of variables declaration

118
public nodeCwin()
{
super();
initializeComponent();
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
* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent()
{
contentPane = (JPanel)this.getContentPane();
//-----

JLabel image= new JLabel();


ImageIcon nn = new ImageIcon(this.getClass().getResource("bg.png"));
image.setIcon(nn);

tit1=new JLabel();
TitledBorder titled1 = new TitledBorder("Node B");
tit1.setBorder(titled1);

//----

tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node F");
tit2.setBorder(titled2);

reset = new JButton("Reset");


reset.addActionListener(this);
reset.setBorder(BorderFactory.createRaisedBevelBorder());
reset.setBackground(new Color(139,69,0));
//---

119
jPanel1 = new JPanel();
jPanel1.setBackground(new Color(139,69,0));

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(255,165,79));

//--
des1 =new JTextArea();
des2 =new JTextArea();

//--

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

//----
addComponent(contentPane, title, 60,25,750,30);
addComponent(contentPane, title1, 200,65,750,30);
addComponent(contentPane, tit1, 90,350,225,250);
addComponent(contentPane, tit2, 465,350,225,250);

addComponent(contentPane, des1, 130,380,145,200);


addComponent(contentPane, des2, 510,380,145,200);

addComponent(contentPane, image, 240,80,350,300);

addComponent(contentPane, reset, 355,625,100,25);


addComponent(contentPane, jPanel1, 6,6,800,106);
addComponent(contentPane, jPanel2, 6,113,800,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeCwin
//
this.setTitle("nodeC");
this.setLocation(new Point(35, 10));
this.setSize(new Dimension(820, 700));

120
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}

public void actionPerformed(ActionEvent ae)

if(ae.getSource()==reset)
{

des1.setText("");
des2.setText("");

/** 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);
}

public class nodeC extends UnicastRemoteObject implements srvint


{

nodeCwin gp1c2=new nodeCwin();


srvint gi3;

public nodeC()throws RemoteException


{
}

public void simulate(String s) throws RemoteException


{

121
}
public void getfile(String [] path,int l,String [] file)
{
try
{

String ms,gs3;

String p=path[l-1];

if(p.equals("b"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des1.append("\n");
gp1c2.des1.append("packet["+i+"]:Received");
gi3.pack(i,"c");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
}
else if(p.equals("f"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

122
if(file[i] !=null)
{
gp1c2.des2.append("\n");
gp1c2.des2.append("packet["+i+"]:Received");
gi3.pack(i,"c");

try
{
Thread.sleep(1500);

}catch(Exception e){}

new client3(path,l,file);
new client33(path,l);

}catch(Exception e){}

}
public double [] perform(String [] p) throws RemoteException
{
double [] d =new double [5];

return d;
}
public String [] path(String a)throws RemoteException
{
String [] sss = new String [3];

return sss;
}
public String sendpath(String [] p) throws RemoteException
{

return "dasd";
}

123
public void pack(int i,String name) throws RemoteException
{

if(name.equals("b"))
{

gp1c2.des1.append("Packet["+i+"]:Sent");
gp1c2.des1.append("\n");
}
else if(name.equals("f"))
{

gp1c2.des2.append("Packet["+i+"]:Sent");
gp1c2.des2.append("\n");
}

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
public static void main(String args[])
{
try
{

nodeC c1=new nodeC();


Naming.rebind("c",c1);

}catch(Exception e){}

124
}

class client3 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;
String [] path;
String s1,s2;

Thread t;

client3(String [] spat,int spl,String[] pa)


{

this.pmes=pa;
this.path=spat;
this.l=spl;

t=new Thread(this,"cc3");
t.start();

public void run()


{
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}

catch(Exception e){}

125
}

class client33 extends Thread


{

Thread t;
String [] path;
int l;

client33(String [] pat,int len)


{
this.path=pat;
this.l=len;
t=new Thread(this,"cc33");
t.start();

public void run()


{

l=l+1;

String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("c"+path[l]);
t.sleep(2500);
}
catch(Exception e){}

126
}

Node D:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import java.lang.*;
import java.util.*;

class nodeDwin extends JFrame implements ActionListener


{
//---

java.util.Date d = new java.util.Date();

127
String str=d.toString();
String array[]=str.split(" ");
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

//---
private JPanel contentPane;
//-----

private JPanel jPanel1;


//-----
private JPanel jPanel2;
//-----

JLabel tit0,tit1,tit2;
JLabel title = new JLabel("<html><font color=#ffffff size=+2><strong>Handling
Multiple Failures in IP Networks through Localized</strong></font></html>");
JLabel title1 = new JLabel("<html><font color=#ffffff size=+2><strong> On-Demand
Link State Routing</strong></font></html>");
//--
JTextArea des0,des1,des2;
JButton reset;

//-----
// End of variables declaration

public nodeDwin()
{
super();
initializeComponent();
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.

128
* 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()
{
contentPane = (JPanel)this.getContentPane();
//-----

JLabel image= new JLabel();


ImageIcon nn = new ImageIcon(this.getClass().getResource("bg.png"));
image.setIcon(nn);

tit0=new JLabel();
TitledBorder titled0 = new TitledBorder("Node A");
tit0.setBorder(titled0);

tit1=new JLabel();
TitledBorder titled1 = new TitledBorder("Node E");
tit1.setBorder(titled1);

//----

tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node G");
tit2.setBorder(titled2);

reset = new JButton("Reset");


reset.addActionListener(this);
reset.setBorder(BorderFactory.createRaisedBevelBorder());
reset.setBackground(new Color(254,155,54));
//---

jPanel1 = new JPanel();


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

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(255,102,102));

129
//--
des0 =new JTextArea();
des1 =new JTextArea();
des2 =new JTextArea();

//--

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

//----
addComponent(contentPane, title, 60,25,750,30);
addComponent(contentPane, title1, 200,65,750,30);
addComponent(contentPane, tit0, 50,350,225,250);
addComponent(contentPane, tit1, 300,350,225,250);
addComponent(contentPane, tit2, 555,350,225,250);

addComponent(contentPane, des0, 90,380,145,200);


addComponent(contentPane, des1, 340,380,145,200);
addComponent(contentPane, des2, 600,380,145,200);

addComponent(contentPane, reset, 375,625,100,25);

addComponent(contentPane, image, 250,85,350,300);

addComponent(contentPane, jPanel1, 6,6,800,106);


addComponent(contentPane, jPanel2, 6,113,800,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeDwin
//
this.setTitle("nodeD");
this.setLocation(new Point(35, 10));
this.setSize(new Dimension(820, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}
public void actionPerformed(ActionEvent ae)

130
if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");
des2.setText("");

/** 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);
}

public class nodeD extends UnicastRemoteObject implements srvint


{

nodeDwin gp1c2=new nodeDwin();


srvint gi3;

public nodeD()throws RemoteException


{
}
public void simulate(String s) throws RemoteException
{
}

public String sendpath(String [] p) throws RemoteException


{

return "dasd";
}

131
public double [] perform(String [] p) throws RemoteException
{
double [] d =new double [5];

return d;
}

public String [] path(String a)throws RemoteException


{
String [] sss = new String [3];

return sss;
}

public void getfile(String [] path,int l,String [] file)


{
try
{

String ms,gs3;

String p=path[l-1];

if(p.equals("a"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des0.append("\n");
gp1c2.des0.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

132
}

}
}
else if(p.equals("e"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des1.append("\n");
gp1c2.des1.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
else if(p.equals("g"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)

133
{
gp1c2.des2.append("\n");
gp1c2.des2.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

new client4(path,l,file);
new client44(path,l);

}catch(Exception e){}

public void pack(int i,String name) throws RemoteException


{

if(name.equals("a"))
{
gp1c2.des0.append("Packet["+i+"]:Sent");
gp1c2.des0.append("\n");
}
else if(name.equals("e"))
{
gp1c2.des1.append("Packet["+i+"]:Sent");
gp1c2.des1.append("\n");
}
else if(name.equals("g"))
{
gp1c2.des2.append("Packet["+i+"]:Sent");

134
gp1c2.des2.append("\n");
}

try
{
Thread.sleep(1500);

}catch(Exception e){}

public static void main(String args[])


{
try
{

nodeD c1=new nodeD();


Naming.rebind("d",c1);

}catch(Exception e){}

class client4 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;
String [] path;
String s1,s2;

Thread t;

client4(String [] spat,int spl,String[] pa)


{

this.pmes=pa;

135
this.path=spat;
this.l=spl;

t=new Thread(this,"cc4");
t.start();

public void run()


{
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}

catch(Exception e){}

class client44 extends Thread


{

Thread t;
String [] path;
int l;

client44(String [] pat,int len)


{
this.path=pat;

136
this.l=len;
t=new Thread(this,"cc44");
t.start();

public void run()


{

l=l+1;

String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("d"+path[l]);
t.sleep(2500);
}
catch(Exception e){}

137
Node E:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import java.lang.*;
import java.util.*;

class nodeDwin extends JFrame implements ActionListener


{
//---

java.util.Date d = new java.util.Date();


String str=d.toString();
String array[]=str.split(" ");
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

//---
private JPanel contentPane;
//-----

138
private JPanel jPanel1;
//-----
private JPanel jPanel2;
//-----

JLabel tit0,tit1,tit2;
JLabel title = new JLabel("<html><font color=#ffffff size=+2><strong>Handling
Multiple Failures in IP Networks through Localized</strong></font></html>");
JLabel title1 = new JLabel("<html><font color=#ffffff size=+2><strong> On-Demand
Link State Routing</strong></font></html>");
//--
JTextArea des0,des1,des2;
JButton reset;

//-----
// End of variables declaration

public nodeDwin()
{
super();
initializeComponent();
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
* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent()
{
contentPane = (JPanel)this.getContentPane();
//-----

JLabel image= new JLabel();


ImageIcon nn = new ImageIcon(this.getClass().getResource("bg.png"));
image.setIcon(nn);

tit0=new JLabel();

139
TitledBorder titled0 = new TitledBorder("Node A");
tit0.setBorder(titled0);

tit1=new JLabel();
TitledBorder titled1 = new TitledBorder("Node E");
tit1.setBorder(titled1);

//----

tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node G");
tit2.setBorder(titled2);

reset = new JButton("Reset");


reset.addActionListener(this);
reset.setBorder(BorderFactory.createRaisedBevelBorder());
reset.setBackground(new Color(254,155,54));
//---

jPanel1 = new JPanel();


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

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(255,102,102));

//--
des0 =new JTextArea();
des1 =new JTextArea();
des2 =new JTextArea();

//--

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

//----

140
addComponent(contentPane, title, 60,25,750,30);
addComponent(contentPane, title1, 200,65,750,30);
addComponent(contentPane, tit0, 50,350,225,250);
addComponent(contentPane, tit1, 300,350,225,250);
addComponent(contentPane, tit2, 555,350,225,250);

addComponent(contentPane, des0, 90,380,145,200);


addComponent(contentPane, des1, 340,380,145,200);
addComponent(contentPane, des2, 600,380,145,200);

addComponent(contentPane, reset, 375,625,100,25);

addComponent(contentPane, image, 250,85,350,300);

addComponent(contentPane, jPanel1, 6,6,800,106);


addComponent(contentPane, jPanel2, 6,113,800,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeDwin
//
this.setTitle("nodeD");
this.setLocation(new Point(35, 10));
this.setSize(new Dimension(820, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}
public void actionPerformed(ActionEvent ae)

if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");
des2.setText("");

141
/** 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);
}

public class nodeD extends UnicastRemoteObject implements srvint


{

nodeDwin gp1c2=new nodeDwin();


srvint gi3;

public nodeD()throws RemoteException


{
}
public void simulate(String s) throws RemoteException
{
}

public String sendpath(String [] p) throws RemoteException


{

return "dasd";
}

public double [] perform(String [] p) throws RemoteException


{
double [] d =new double [5];

return d;
}

public String [] path(String a)throws RemoteException


{
String [] sss = new String [3];

return sss;
}

142
public void getfile(String [] path,int l,String [] file)
{
try
{

String ms,gs3;

String p=path[l-1];

if(p.equals("a"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des0.append("\n");
gp1c2.des0.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
}
else if(p.equals("e"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

143
{

if(file[i] !=null)
{
gp1c2.des1.append("\n");
gp1c2.des1.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
else if(p.equals("g"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des2.append("\n");
gp1c2.des2.append("packet["+i+"]:Received");
gi3.pack(i,"b");

try
{
Thread.sleep(1500);

}catch(Exception e){}

144
}

new client4(path,l,file);
new client44(path,l);

}catch(Exception e){}

public void pack(int i,String name) throws RemoteException


{

if(name.equals("a"))
{
gp1c2.des0.append("Packet["+i+"]:Sent");
gp1c2.des0.append("\n");
}
else if(name.equals("e"))
{
gp1c2.des1.append("Packet["+i+"]:Sent");
gp1c2.des1.append("\n");
}
else if(name.equals("g"))
{
gp1c2.des2.append("Packet["+i+"]:Sent");
gp1c2.des2.append("\n");
}

try
{
Thread.sleep(1500);

}catch(Exception e){}

145
public static void main(String args[])
{
try
{

nodeD c1=new nodeD();


Naming.rebind("d",c1);

}catch(Exception e){}

class client4 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;
String [] path;
String s1,s2;

Thread t;

client4(String [] spat,int spl,String[] pa)


{

this.pmes=pa;
this.path=spat;
this.l=spl;

t=new Thread(this,"cc4");
t.start();

public void run()


{

146
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}

catch(Exception e){}

class client44 extends Thread


{

Thread t;
String [] path;
int l;

client44(String [] pat,int len)


{
this.path=pat;
this.l=len;
t=new Thread(this,"cc44");
t.start();

public void run()


{

l=l+1;

147
String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("d"+path[l]);
t.sleep(2500);
}
catch(Exception e){}

}
Node F:-

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import java.lang.*;
import java.util.*;

148
class nodeFwin extends JFrame implements ActionListener
{
//---

java.util.Date d = new java.util.Date();


String str=d.toString();
String array[]=str.split(" ");
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

//---
private JPanel contentPane;
//-----

private JPanel jPanel1;


//-----
private JPanel jPanel2;
//-----

JLabel tit0,tit1,tit2;

JLabel title = new JLabel("<html><font color=#ffffff size=+2><strong>Handling


Multiple Failures in IP Networks through Localized</strong></font></html>");
JLabel title1 = new JLabel("<html><font color=#ffffff size=+2><strong> On-Demand
Link State Routing</strong></font></html>");

//--
JTextArea des0,des1,des2;
JButton reset;

//-----
// End of variables declaration

public nodeFwin()
{
super();
initializeComponent();

149
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
* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent()
{
contentPane = (JPanel)this.getContentPane();

JLabel image= new JLabel();


ImageIcon nn = new ImageIcon(this.getClass().getResource("bg.png"));
image.setIcon(nn);

//-----

tit0=new JLabel();
TitledBorder titled0 = new TitledBorder("Node C");
tit0.setBorder(titled0);

tit1=new JLabel();
TitledBorder titled1 = new TitledBorder("Node E");
tit1.setBorder(titled1);

//----

tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node I");
tit2.setBorder(titled2);

//---

jPanel1 = new JPanel();


jPanel1.setBackground(new Color(139,69,0));

150
jPanel2 = new JPanel();
jPanel2.setBackground(new Color(255,165,79));

reset = new JButton("Reset");


reset.addActionListener(this);
reset.setBorder(BorderFactory.createRaisedBevelBorder());
reset.setBackground(new Color(139,69,0));

//--
des0 =new JTextArea();
des1 =new JTextArea();
des2 =new JTextArea();

//--

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

//----

addComponent(contentPane, title, 60,25,750,30);


addComponent(contentPane, title1, 200,65,750,30);
addComponent(contentPane, tit0, 50,350,225,250);
addComponent(contentPane, tit1, 300,350,225,250);
addComponent(contentPane, tit2, 555,350,225,250);

addComponent(contentPane, des0, 90,380,145,200);


addComponent(contentPane, des1, 340,380,145,200);
addComponent(contentPane, des2, 600,380,145,200);
addComponent(contentPane, reset, 375,625,100,25);

addComponent(contentPane, image, 250,85,350,300);

addComponent(contentPane, jPanel1, 6,6,800,106);


addComponent(contentPane, jPanel2, 6,113,800,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeFwin
//

151
this.setTitle("nodeF");
this.setLocation(new Point(75, 10));
this.setSize(new Dimension(820, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}

public void actionPerformed(ActionEvent ae)

if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");
des2.setText("");

/** 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);
}

public class nodeF extends UnicastRemoteObject implements srvint


{

nodeFwin gp1c2=new nodeFwin();


srvint gi3;

public nodeF()throws RemoteException


{
}

public void simulate(String s) throws RemoteException

152
{
}

public void getfile(String [] path,int l,String [] file)


{
try
{

String ms,gs3;

String p=path[l-1];

if(p.equals("c"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des0.append("\n");
gp1c2.des0.append("packet["+i+"]:Received");
gi3.pack(i,"f");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
}
else if(p.equals("e"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

153
for(int i=0;i<7;i++)
{

if(file[i] !=null)
{
gp1c2.des1.append("\n");
gp1c2.des1.append("packet["+i+"]:Received");
gi3.pack(i,"f");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
else if(p.equals("f"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des2.append("\n");
gp1c2.des2.append("packet["+i+"]:Received");
gi3.pack(i,"f");

try
{
Thread.sleep(1000);

}catch(Exception e){}

154
}

new client6(path,l,file);
new client66(path,l);
}catch(Exception e){}

}
public double [] perform(String [] p) throws RemoteException
{
double [] d =new double [5];

return d;
}
public String [] path(String a)throws RemoteException
{
String [] sss = new String [3];

return sss;
}
public String sendpath(String [] p) throws RemoteException
{

return "dasd";
}
public void pack(int i,String name) throws RemoteException
{

if(name.equals("c"))
{

gp1c2.des0.append("Packet["+i+"]:Sent");
gp1c2.des0.append("\n");
}
else if(name.equals("e"))
{

gp1c2.des1.append("Packet["+i+"]:Sent");

155
gp1c2.des1.append("\n");
}
else if(name.equals("i"))
{

gp1c2.des2.append("Packet["+i+"]:Sent");
gp1c2.des2.append("\n");
}

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
public static void main(String args[])
{
try
{

nodeF c1=new nodeF();


Naming.rebind("f",c1);

}catch(Exception e){}

class client6 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;

156
String [] path;
String s1,s2;

Thread t;

client6(String [] spat,int spl,String[] pa)


{

this.pmes=pa;
this.path=spat;
this.l=spl;

t=new Thread(this,"cc6");
t.start();

public void run()


{
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}

catch(Exception e){}

class client66 extends Thread

157
{

Thread t;
String [] path;
int l;

client66(String [] pat,int len)


{
this.path=pat;
this.l=len;
t=new Thread(this,"cc66");
t.start();

public void run()


{

l=l+1;

String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("f"+path[l]);
t.sleep(2500);
}
catch(Exception e){}

Node G:-

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;

158
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import java.lang.*;
import java.util.*;

class nodeGwin extends JFrame implements ActionListener


{
//---

java.util.Date d = new java.util.Date();


String str=d.toString();
String array[]=str.split(" ");
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

//---
private JPanel contentPane;
//-----

private JPanel jPanel1;


//-----
private JPanel jPanel2;
//-----

159
JLabel tit1,tit2;

JLabel title = new JLabel("<html><font color=#ffffff size=+2><strong>Handling


Multiple Failures in IP Networks through Localized</strong></font></html>");
JLabel title1 = new JLabel("<html><font color=#ffffff size=+2><strong> On-Demand
Link State Routing</strong></font></html>");

//--
JTextArea des1,des2;
JButton reset;

//-----
// End of variables declaration

public nodeGwin()
{
super();
initializeComponent();
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
* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent()
{
contentPane = (JPanel)this.getContentPane();
//-----

JLabel image= new JLabel();


ImageIcon nn = new ImageIcon(this.getClass().getResource("bg.png"));
image.setIcon(nn);

tit1=new JLabel();

160
TitledBorder titled1 = new TitledBorder("Node D");
tit1.setBorder(titled1);

//----

tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node H");
tit2.setBorder(titled2);

//---

jPanel1 = new JPanel();


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

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(255,102,102));

reset = new JButton("Reset");


reset.addActionListener(this);
reset.setBorder(BorderFactory.createRaisedBevelBorder());
reset.setBackground(new Color(254,155,54));

//--
des1 =new JTextArea();
des2 =new JTextArea();

//--

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

//----

addComponent(contentPane, title, 60,25,750,30);


addComponent(contentPane, title1, 200,65,750,30);
addComponent(contentPane, tit1, 90,350,225,250);
addComponent(contentPane, tit2, 465,350,225,250);

addComponent(contentPane, des1, 130,380,145,200);


addComponent(contentPane, des2, 510,380,145,200);
addComponent(contentPane, reset, 355,625,100,25);

161
addComponent(contentPane, image, 250,85,350,300);
addComponent(contentPane, jPanel1, 6,6,800,106);
addComponent(contentPane, jPanel2, 6,113,800,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeGwin
//
this.setTitle("nodeG");
this.setLocation(new Point(75, 10));
this.setSize(new Dimension(820, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}

public void actionPerformed(ActionEvent ae)

if(ae.getSource()==reset)
{

des1.setText("");
des2.setText("");

/** 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);
}

162
public class nodeG extends UnicastRemoteObject implements srvint
{

nodeGwin gp1c2=new nodeGwin();


srvint gi3;

public nodeG()throws RemoteException


{
}

public void simulate(String s) throws RemoteException


{
}
public void getfile(String [] path,int l,String [] file)
{
try
{

String ms,gs3;

String p=path[l-1];

if(p.equals("d"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des1.append("\n");
gp1c2.des1.append("packet["+i+"]:Received");
gi3.pack(i,"g");

try
{
Thread.sleep(1500);

}catch(Exception e){}

163
}
}
else if(p.equals("h"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des2.append("\n");
gp1c2.des2.append("packet["+i+"]:Received");
gi3.pack(i,"g");

try
{
Thread.sleep(1500);

}catch(Exception e){}

new client7(path,l,file);
new client77(path,l);

}catch(Exception e){}

}
public double [] perform(String [] p) throws RemoteException
{
double [] d =new double [5];

164
return d;
}
public String [] path(String a)throws RemoteException
{
String [] sss = new String [3];

return sss;
}
public String sendpath(String [] p) throws RemoteException
{

return "dasd";
}
public void pack(int i,String name) throws RemoteException
{
if(name.equals("d"))
{
gp1c2.des1.append("Packet["+i+"]:Sent");
gp1c2.des1.append("\n");
}
else if(name.equals("h"))
{
gp1c2.des2.append("Packet["+i+"]:Sent");
gp1c2.des2.append("\n");
}

try
{
Thread.sleep(1500);

}catch(Exception e){}

public static void main(String args[])


{
try
{

nodeG c1=new nodeG();


Naming.rebind("g",c1);

165
}catch(Exception e){}

class client7 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;
String [] path;
String s1,s2;

Thread t;

client7(String [] spat,int spl,String[] pa)


{

this.pmes=pa;
this.path=spat;
this.l=spl;

t=new Thread(this,"cc3");
t.start();

public void run()


{
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);

166
t.sleep(2500);
}

catch(Exception e){}

class client77 extends Thread


{

Thread t;
String [] path;
int l;

client77(String [] pat,int len)


{
this.path=pat;
this.l=len;
t=new Thread(this,"cc77");
t.start();

public void run()


{

l=l+1;

String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("g"+path[l]);
t.sleep(2500);

167
}
catch(Exception e){}

Node H:-

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
import java.rmi.*;
import java.rmi.server.*;
import java.io.*;
import java.sql.*;

import javax.swing.BorderFactory;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.BevelBorder;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import javax.swing.border.TitledBorder;

import java.lang.*;
import java.util.*;

class nodeHwin extends JFrame implements ActionListener


{
//---

168
java.util.Date d = new java.util.Date();
String str=d.toString();
String array[]=str.split(" ");
public int day=d.getDate();
public String month=array[1];
public String year=array[5];
public String time=array[3];
String dat=new String(day+"\\"+month+"\\"+year);

//---
private JPanel contentPane;
//-----

private JPanel jPanel1;


//-----
private JPanel jPanel2;
//-----

JLabel tit0,tit1,tit2;
JLabel title = new JLabel("<html><font color=#ffffff size=+2><strong>Handling
Multiple Failures in IP Networks through Localized</strong></font></html>");
JLabel title1 = new JLabel("<html><font color=#ffffff size=+2><strong> On-Demand
Link State Routing</strong></font></html>");

//--
JTextArea des0,des1,des2;
JButton reset;

//-----
// End of variables declaration

public nodeHwin()
{
super();
initializeComponent();
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

169
* 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()
{
contentPane = (JPanel)this.getContentPane();
//-----

JLabel image= new JLabel();


ImageIcon nn = new ImageIcon(this.getClass().getResource("bg.png"));
image.setIcon(nn);

tit0=new JLabel();
TitledBorder titled0 = new TitledBorder("Node E");
tit0.setBorder(titled0);

tit1=new JLabel();
TitledBorder titled1 = new TitledBorder("Node G");
tit1.setBorder(titled1);

//----

tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node I");
tit2.setBorder(titled2);

//---

jPanel1 = new JPanel();


jPanel1.setBackground(new Color(0,100,0));

jPanel2 = new JPanel();


jPanel2.setBackground(new Color(124,205,124));

170
reset = new JButton("Reset");
reset.addActionListener(this);
reset.setBorder(BorderFactory.createRaisedBevelBorder());
reset.setBackground(new Color(254,155,54));

//--
des0 =new JTextArea();
des1 =new JTextArea();

des2 =new JTextArea();

//--

contentPane.setLayout(null);
//contentPane.setBackground(new Color());

//----

addComponent(contentPane, title, 60,25,750,30);


addComponent(contentPane, title1, 200,65,750,30);
addComponent(contentPane, tit0, 50,350,225,250);
addComponent(contentPane, tit1, 300,350,225,250);
addComponent(contentPane, tit2, 555,350,225,250);

addComponent(contentPane, des0, 90,380,145,200);


addComponent(contentPane, des1, 340,380,145,200);
addComponent(contentPane, des2, 600,380,145,200);
addComponent(contentPane, reset, 375,625,100,25);
addComponent(contentPane, image, 250,85,350,300);

addComponent(contentPane, jPanel1, 6,6,800,106);


addComponent(contentPane, jPanel2, 6,113,800,550);

// addComponent(jPanel1, tit, 0,0,930,100);


//
// nodeHwin
//
this.setTitle("nodeH");
this.setLocation(new Point(75, 10));
this.setSize(new Dimension(820, 700));
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

171
this.setResizable(false);
}

public void actionPerformed(ActionEvent ae)

if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");
des2.setText("");

}
/** 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);
}

public class nodeH extends UnicastRemoteObject implements srvint


{

nodeHwin gp1c2=new nodeHwin();


srvint gi3;

public nodeH()throws RemoteException


{
}
public void simulate(String s) throws RemoteException
{
}

public void getfile(String [] path,int l,String [] file)


{
try

172
{

String ms,gs3;

String p=path[l-1];

if(p.equals("e"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des0.append("\n");
gp1c2.des0.append("packet["+i+"]:Received");
gi3.pack(i,"h");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
}
else if(p.equals("g"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{

173
gp1c2.des1.append("\n");
gp1c2.des1.append("packet["+i+"]:Received");
gi3.pack(i,"h");

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
else if(p.equals("i"))
{

gs3="rmi://localhost/"+path[l-1];
gi3=(srvint)Naming.lookup(gs3);

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

if(file[i] !=null)
{
gp1c2.des2.append("\n");
gp1c2.des2.append("packet["+i+"]:Received");
gi3.pack(i,"h");

try
{
Thread.sleep(1500);

}catch(Exception e){}

174
}

new client8(path,l,file);
new client88(path,l);

}catch(Exception e){}

}
public double [] perform(String [] p) throws RemoteException
{
double [] d =new double [5];

return d;
}
public String [] path(String a)throws RemoteException
{
String [] sss = new String [3];

return sss;
}
public String sendpath(String [] p) throws RemoteException
{

return "dasd";
}
public void pack(int i,String name) throws RemoteException
{

if(name.equals("e"))
{

gp1c2.des0.append("Packet["+i+"]:Sent");
gp1c2.des0.append("\n");
}
else if(name.equals("g"))
{

gp1c2.des1.append("Packet["+i+"]:Sent");
gp1c2.des1.append("\n");
}
else if(name.equals("i"))
{

175
gp1c2.des2.append("Packet["+i+"]:Sent");
gp1c2.des2.append("\n");
}

try
{
Thread.sleep(1500);

}catch(Exception e){}

}
public static void main(String args[])
{
try
{

nodeH c1=new nodeH();


Naming.rebind("h",c1);

}catch(Exception e){}

class client8 extends Thread


{
String[] pmes=new String[7];
int l=0;
int pl=0;
String [] path;
String s1,s2;

Thread t;

176
client8(String [] spat,int spl,String[] pa)
{

this.pmes=pa;
this.path=spat;
this.l=spl;

t=new Thread(this,"c8");
t.start();

public void run()


{
pl=l+1;

s1="rmi://localhost/"+path[pl];

try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}

catch(Exception e){}

class client88 extends Thread


{

Thread t;
String [] path;

177
int l;

client88(String [] pat,int len)


{
this.path=pat;
this.l=len;
t=new Thread(this,"cc88");
t.start();

public void run()


{

l=l+1;

String s2="rmi://localhost/network";

try
{
srvint gc2=(srvint)Naming.lookup(s2);
gc2.simulate("h"+path[l]);
t.sleep(2500);
}
catch(Exception e){}

178
REFERENCE
J. A. Carballido, I. Ponzoni, and N. B. Brignole, “CGD-GA: A graphbased genetic
algorithm for sensor network design,”Inf. Sci., vol. 177,
no. 22, pp. 5091–5102, 2007.
[2] F. C. Chang and H. C. Huang, “A refactoring method for cache-efficient
swarm intelligence algorithms,” Inf. Sci., vol. 192, no. 1, pp. 39–49,
Jun. 2012.
[3] S. Corson and J. Macker,Mobile Ad Hoc Networking (MANET): Routing
Protocol Performance Issues and Evaluation Considerations.NewYork,
NY, USA: ACM, 1999.
[4] M. Gen and R. Cheng, Genetic Algorithms and Engineering Design.
New York, NY, USA: Wiley, 1997.
[5] Z. He, B. S. Lee, and X. S. Wang, “Aggregation in sensor networks
with a user-provided quality of service goal,”Inf. Sci., vol. 178, no. 9,
pp. 2128–2149, 2008.
[6] J. H. Ho, H. C. Shih, B. Y. Liao, and S. C. Chu, “A ladder diffusion
algorithm using ant colony optimization for wireless sensor networks,”
Inf. Sci., vol. 192, pp. 204–212, Jun. 2012.
[7]J.H.Ho,H.C.Shih,B.Y.Liao,andJ.S.Pan,“Gradediffusion algorithm,” in Proc. 2nd Int.
Conf. Eng. Technol. Innov., 2012,
pp. 2064–2068.
[8] T. P. Hong and C. H. Wu, “An improved weighted clustering algorithm for
determination of application nodes in heterogeneous sensor
networks,” J. Inf. Hiding Multimedia Signal Process., vol. 2, no. 2,
pp. 173–184, 2011.
[9] C. Intanagonwiwat, R. Govindan, D. Estrin, J. Heidemann, and F. Silva,
“Directed diffusion for wireless sensor networking,”IEEE/ACM Trans.
Netw., vol. 11, no. 1, pp. 2–16, Feb. 2003.
[10] W. H. Liao, Y. Kao, and C. M. Fan, “Data aggregation in wireless sensor
networks using ant colony algorithm,”J. Netw. Comput. Appl., vol. 31,
no. 4, pp. 387–401, 2008.
[11] T. H. Liu, S. C. Yi, and X. W. Wang, “A fault management protocol
179
for low-energy and efficient wireless sensor networks,”J. Inf. Hiding
Multimedia Signal Process., vol. 4, no. 1, pp. 34–45, 2013.
[12] J. Pan, Y. Hou, L. Cai, Y. Shi, and X. Shen, “Topology control for
wireless sensor networks,” inProc. 9th ACM Int. Conf. Mobile Comput.
Netw., 2003, pp. 286–299.
[13] E. M. Royer and C. K. Toh, “A review of current routing protocols
for ad-hoc mobile networks,” IEEE Personal Commun., vol. 6, no. 2,
pp. 46–55, Apr. 1999.
[14] H. C. Shih, S. C. Chu, J. Roddick, J. H. Ho, B. Y. Liao, and J. S. Pan,
“A reduce identical event transmission algorithm for wireless sensor
networks,” inProc. 3rd Int. Conf. Intell. Human Comput. Interact., 2011,
pp. 147–154

180

You might also like