Fast ReRouting AnnaFormat Finished2
Fast ReRouting AnnaFormat Finished2
backbone networks and there have been several proposals based on local
these proposals are effective in handling single failures, they either cause loops
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
protection. While the LOLS approach is generic, this paper describes how it can
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
LOLS routing deviates from the optimal path by a small stretch only while
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
GA - Genetic Algorithm
1
LIST OF FIGURES
2
LIST OF TABLES
3
1. INTRODUCTION
1.1 OVERVIEW
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.
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:
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
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
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?
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.
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.
12
4. SYSTEM SPECIFICATION
4.1. HARDWARE CONFIGURATION
The below Hardware Specifications were used in both Server and Client machines
when developing.
The below Software Specifications were used in both Server and Client machines
when developing.
13
5. DETAIL DESCRIPTION OF TECHNOLOGY
5.1. FEATURE OF JAVA TECHNOLOGY
Simple
Architecture neutral
Object oriented
Portable
Distributed
High performance
Interpreted
Multithreaded
Robust
Dynamic
Secure
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.
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.
Compilers My Program
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:
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
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 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.
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:
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:
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:
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.
Future.
Trigger an action.
Confirm an action.
34
7. SYSTEM ARCHITECTURE
7.1. SYSTEM ARCHITECTURE
35
7.2. DATA FLOW DIAGRAM
Node G Node H
Destination
36
7.3. UML 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.
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.
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.
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.
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.
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.
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.
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.
Execute all loops at their boundaries and with in their operational bounds and
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.
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;
//---
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;
//-----
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>");
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");
68
//---- cost values label & textfield
//-----
// 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();
//-----
titb=new JLabel();
TitledBorder titled = new TitledBorder("NetWork Monitor");
titb.setBorder(thickBorder);
70
//--
//--
//--
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());
//--horizontal lines
addComponent(contentPane, ab, 85,170,150,30);
addComponent(contentPane, de, 85,300,150,30);
addComponent(contentPane, gh, 85,430,150,30);
72
//----cost values
//--
//----
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);
//----
{
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();
}
catch(Exception e){
System.out.println(e);
}
76
}
//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"));
String [] path;
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";
}
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);
}
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);
}
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";
}
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;
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;
}
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;
}
84
public void simulate(String s) throws RemoteException
{
System.out.println(s);
try{
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)
{
}
91
Naming.rebind("network",c1);
}catch(Exception e){}
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.*;
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 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();
//-----
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);
//---
//--
open = new JButton("open");
open.addActionListener(this);
open.setBorder(BorderFactory.createRaisedBevelBorder());
open.setBackground(new Color(254,155,54));
95
path.setBorder(BorderFactory.createRaisedBevelBorder());
path.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());
//----
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);
{
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("--->","");
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];
//---
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]);
}
}
catch(Exception ee)
{
}
100
}
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");
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("--->","");
System.out.println("impossible:"+allp[j]);
}
else
{
path1.append("\n");
path1.append(allp[j]);
System.out.println("possible:"+allp[j]);
}
102
}
}
catch(Exception e){}
}
}
}
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){}
return d;
}
public String sendpath(String [] p) throws RemoteException
{
return "dasd";
}
}
public String [] path(String a)throws RemoteException
{
String [] sss = new String [3];
return sss;
}
104
Naming.rebind("a",c1);
}catch(Exception e){}
Thread t;
this.pmes=pa;
this.path=spat;
this.l=spl;
t=new Thread(this,"cc1");
t.start();
s1="rmi://localhost/"+path[pl];
try
{
srvint gc1=(srvint)Naming.lookup(s1);
105
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}
catch(Exception e){}
Thread t;
String [] path;
int l;
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.*;
107
//---
private JPanel contentPane;
//-----
JLabel tit0,tit1,tit2;
//--
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
//-----
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);
//---
//--
des0 =new JTextArea();
des1 =new JTextArea();
des2 =new JTextArea();
//--
contentPane.setLayout(null);
109
//contentPane.setBackground(new Color());
//----
if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");
110
des2.setText("");
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
{
}catch(Exception e){}
Thread t;
this.pmes=pa;
this.path=spat;
this.l=spl;
t=new Thread(this,"cc2");
t.start();
115
}
s1="rmi://localhost/"+path[pl];
try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}
catch(Exception e){}
Thread t;
String [] path;
int l;
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.*;
//---
private JPanel contentPane;
//-----
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();
//-----
tit1=new JLabel();
TitledBorder titled1 = new TitledBorder("Node B");
tit1.setBorder(titled1);
//----
tit2=new JLabel();
TitledBorder titled2 = new TitledBorder("Node F");
tit2.setBorder(titled2);
119
jPanel1 = new JPanel();
jPanel1.setBackground(new Color(139,69,0));
//--
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);
120
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setResizable(false);
}
if(ae.getSource()==reset)
{
des1.setText("");
des2.setText("");
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
{
}catch(Exception e){}
124
}
Thread t;
this.pmes=pa;
this.path=spat;
this.l=spl;
t=new Thread(this,"cc3");
t.start();
s1="rmi://localhost/"+path[pl];
try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}
catch(Exception e){}
125
}
Thread t;
String [] path;
int l;
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.*;
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;
//-----
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();
//-----
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);
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);
130
if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");
des2.setText("");
return "dasd";
}
131
public double [] perform(String [] p) throws RemoteException
{
double [] d =new double [5];
return d;
}
return sss;
}
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){}
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){}
}catch(Exception e){}
Thread t;
this.pmes=pa;
135
this.path=spat;
this.l=spl;
t=new Thread(this,"cc4");
t.start();
s1="rmi://localhost/"+path[pl];
try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}
catch(Exception e){}
Thread t;
String [] path;
int l;
136
this.l=len;
t=new Thread(this,"cc44");
t.start();
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.*;
//---
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();
//-----
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);
//--
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);
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);
}
return "dasd";
}
return d;
}
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){}
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
{
}catch(Exception e){}
Thread t;
this.pmes=pa;
this.path=spat;
this.l=spl;
t=new Thread(this,"cc4");
t.start();
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){}
Thread t;
String [] path;
int l;
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
{
//---
//---
private JPanel contentPane;
//-----
JLabel tit0,tit1,tit2;
//--
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();
//-----
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);
//---
150
jPanel2 = new JPanel();
jPanel2.setBackground(new Color(255,165,79));
//--
des0 =new JTextArea();
des1 =new JTextArea();
des2 =new JTextArea();
//--
contentPane.setLayout(null);
//contentPane.setBackground(new Color());
//----
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);
}
if(ae.getSource()==reset)
{
des0.setText("");
des1.setText("");
des2.setText("");
152
{
}
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
{
}catch(Exception e){}
156
String [] path;
String s1,s2;
Thread t;
this.pmes=pa;
this.path=spat;
this.l=spl;
t=new Thread(this,"cc6");
t.start();
s1="rmi://localhost/"+path[pl];
try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}
catch(Exception e){}
157
{
Thread t;
String [] path;
int l;
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.*;
//---
private JPanel contentPane;
//-----
159
JLabel tit1,tit2;
//--
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();
//-----
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);
//---
//--
des1 =new JTextArea();
des2 =new JTextArea();
//--
contentPane.setLayout(null);
//contentPane.setBackground(new Color());
//----
161
addComponent(contentPane, image, 250,85,350,300);
addComponent(contentPane, jPanel1, 6,6,800,106);
addComponent(contentPane, jPanel2, 6,113,800,550);
if(ae.getSource()==reset)
{
des1.setText("");
des2.setText("");
162
public class nodeG extends UnicastRemoteObject implements srvint
{
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){}
165
}catch(Exception e){}
Thread t;
this.pmes=pa;
this.path=spat;
this.l=spl;
t=new Thread(this,"cc3");
t.start();
s1="rmi://localhost/"+path[pl];
try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
166
t.sleep(2500);
}
catch(Exception e){}
Thread t;
String [] path;
int l;
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.*;
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;
//-----
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();
//-----
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);
//---
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();
//--
contentPane.setLayout(null);
//contentPane.setBackground(new Color());
//----
171
this.setResizable(false);
}
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);
}
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
{
}catch(Exception e){}
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();
s1="rmi://localhost/"+path[pl];
try
{
srvint gc1=(srvint)Naming.lookup(s1);
gc1.getfile(path,pl,pmes);
t.sleep(2500);
}
catch(Exception e){}
Thread t;
String [] path;
177
int l;
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