Sunteți pe pagina 1din 65

Location Based Routing

For
Distance Nodes

CONTENTS
1. INTRODUCTION
2. ORGANIZATION PROFILE
3. SYSTEM ANALYSIS
3.1 Existing System
3.2 Limitations
3.3 Proposed System
4. PROBLEM FORMULATION
4.1 Hardware Specification
4.2 Software Specification
4.3 Software Descriptions
5. SYSTEM DESIGN
5.1 Data Flow Diagram
6. SYSTEM TESTING
6.1 Unit Testing
6.2 Integration Testing
6.3 Acceptance Testing
7. SYSTEM IMPLMENTATION
8. CONCLUSION
9. BIBLIOGRAPHY
10. APPENDICES
APPENDIX A: SAMPLE SCREENS
APPENDIX B: SAMPLE CODE

1. INTRODUCTION
An location based routing is a collection of mobile nodes that are dynamically
and arbitrarily located in such a manner that the interconnections between nodes are
capable of changing on a continual basis. The primary goal of this routing is correct
and efficient route establishment between a pair of nodes so that messages may be
delivered in a timely manner. LAR is an on-demand protocol who is based on the
DSR(Dynamic Source Routing). The Location Aided Routing protocol uses location
information to reduce routing overhead of the ad-hoc network! Normally the LAR
protocol uses the GPS(Gloal Positioning System) to get these location informations.
With the availability of GPS, the mobile hosts knows there physical location.
Unlike traditional distance networks, networks do not rely on any fixed
infrastructure. Instead, hosts rely on each other to keep the network connected. The
military tactical and other security-sensitive operations are still the main applications
of ad hoc networks, although there is a trend to adopt ad hoc networks for commercial
uses due to their unique properties. One main challenge in design of these networks is
their vulnerability to security attacks. In this paper, we study the threats an ad hoc
network faces and the security goals to be achieved. We identify the new challenges
and opportunities posed by this new networking environment and explore new
approaches to secure its communication. In particular, we take advantage of the
inherent redundancy in ad hoc networks multiple routes between nodes to
defend routing against denial of service attacks. We also use replication and new
cryptographic schemes, such as threshold cryptography, to build a highly secure and
highly available key management service, which forms the core of our security
framework.
The networks are a new paradigm of wireless communication for mobile hosts (which
we call nodes). In this routing, there is no fixed infrastructure such as base stations or
mobile switching centers. Mobile nodes that are within each others radio range
communicate directly via wireless links, while those that are far apart rely on other
nodes to relay messages as routers. Node mobility in an ad hoc network causes
frequent changes of the network topology. Figure 1 shows such an example: initially,

nodes A and D have a direct link between them. When D moves out of As radio
range, the link is broken. However, the network is still connected, because A can
reach D through C, E, and F. Military tactical operations are still the main application
of ad hoc networks today. For example, military units (e.g., soldiers, tanks, or planes),
equipped with wireless communication devices, could form an ad hoc network when
they roam in a battlefield. The networks can also be used for emergency, law
enforcement, and rescue missions. Since an ad hoc network can be deployed rapidly
with relatively low cost, it becomes an attractive option for commercial uses such as
sensor networks or virtual classrooms.

2. ORGANIZATION PROFILE
COMPANY PROFILE.
At Blue Chip Technologies, We go beyond providing software solutions. We
work with our clients technologies and business changes that shape their
competitive advantages.
Founded in 2000, Blue Chip Technologies (P) Ltd. is a software and service
provider that helps organizations deploy, manage, and support their businesscritical software more effectively. Utilizing a combination of proprietary
software, services and specialized expertise, Blue Chip Technologies (P) Ltd.
helps mid-to-large enterprises, software companies and IT service providers
improve consistency, speed, and transparency with service delivery at lower
costs. Blue Chip Technologies (P) Ltd. helps companies avoid many of the
delays, costs and risks associated with the distribution and support of software
on desktops, servers and remote devices. Our automated solutions include
rapid, touch-free deployments, ongoing software upgrades, fixes and security
patches,

technology

asset

inventory

and

tracking,

software

license

optimization, application self-healing and policy management. At Blue Chip


Technologies, we go beyond providing software solutions. We work with our
clients technologies and business processes that shape there competitive
advantages.

About The People


As a team we have the prowess to have a clear vision and realize it too. As a
statistical evaluation, the team has more than 40,000 hours of expertise in
providing real-time solutions in the fields of Embedded Systems, Control
systems, Micro-Controllers, c Based Interfacing, Programmable Logic
Controller, VLSI Design And Implementation, Networking With C, ++, java,

client Server Technologies in Java,(J2EE\J2ME\J2SE\EJB),VB & VC++,


Oracle and operating system concepts with LINUX.
Our Vision
Dreaming a vision is possible and realizing it is our goal.
Our Mission
We have achieved this by creating and perfecting processes that are in par with
the global standards and we deliver high quality, high value services, reliable
and cost effective IT products to clients around the world.

Clientele.
Aray InfoTech
Inquirre consultancy (U.S.A)
K square consultancy pvt Ltd (U.S.A)
Opal solutions
Texlab Solutions
Vertex Business Machines
JM InfoTech

3. SYSTEM ANALYSIS
6

3.1 EXISTING SYSTEM:


Infra-structured Networks
The first one is to introduce a third fixed party (a base station) that will hand over the
offered traffic from a station to another, as illustrated in Figure 1. The same entity will
regulate the attribution of radio resources, for instance. When a node S wishes to
communicate to a node D, the former notifies the base station, which eventually establishes a
communication with the destination node. At this point, the communicating nodes do not need
to know of a route for one to each other. All that matters is that both nodes source and
destination are within the transmission range of the base station. If one of them fails to fulfill
this condition, the communication will abort.

D
BASE STATION

E (OUT OF RANGE)

Infra structured Network

Here the base stations range is illustrated by the oval. The two nodes S and D which want to
communicate are in the range of the base station. S send the message to the base station which

in turn forwards it to destination node D. Thus communication is carried out with help of a
base station. All messages have to pass through the base station. Node E is out of the range of
the base station this prevents it from communicating to other nodes in the network. When
node E wants to communicate to any node in the network it has to contact the base station.
Since it is out of range communication is not possible.
What happens if the base station is unavailable? Or what happens if we are in a situation
where such an infrastructure does not exist at the first place?
The answer is that we simply do not communicate! This is where the second approach is
useful. JNote however that this form of centralized administration is very popular among
wide cellular networks such as GSM etc.

3.2 Limitations
The following are the limitations of the existing system.

Maintenance of information is done manually

Data collection is not uniform and is stored in different forms

Locating the appropriate server and client profile and updating it whenever required
becomes cumbersome.

Enforcement of data integrity not possible.

Unavailable of prominent security measures for data collection.

3.3 PROPOSED SYSTEM:


Location Based Routing
The concept behind these infra-structureless networks is the collaboration between its
participating members, i.e, instead of making data transit through a fixed base station, nodes
consequentially forward data packets from one to another until a destination node is finally
reached. Typically, a packet may travel through a number of network points before arriving at
its destination.

Location Based Routing introduces a completely new flavor of network formation. The
routers and hosts are free to move randomly and organize themselves in an arbitrary fashion,
thus the network topology changes rapidly and unpredictably. Absence of a supporting
structure in mobile ad-hoc networks, to a certain extent, invalidates almost all of the existing
techniques developed for routine network controls in the existing wireless networks.
A MANET consists of mobile platforms (e.g., a router with multiple hosts and wireless
communications devices)--herein simply referred to as "nodes"--which are free to move about
arbitrarily. The nodes may be located in or on airplanes, ships, trucks, cars, perhaps even on
people or very small devices, and there may be multiple hosts per router. A MANET is an
autonomous system of mobile nodes. The system may operate in isolation, or may have
gateways to and interface with a fixed network.

Infra-structure less Network


Here the node S wants to communicate to node D. The oval indicates the communication
range of the node. The communication range of S does not exceed to include D. In this case
routing is necessary, node E is in the range of S which has D in its range. So S in order to

communicate to D, first sends the message to E which inturn forwards it to D. Thus the node
E acts as a router and a node.

10

4. System Requirements

4.1 HARDWARE SPECIFICATION


Processor

: Any Processor above 500 Mhz.

Ram

: 128Mb.

Hard Disk

: 10 Gb.

Compact Disk

: 650 Mb.

Input device

: Standard Keyboard and Mouse.

Output device

: VGA and High Resolution Monitor.

4.2 SOFTWARE SPECIFICATION


Language : Java1.3
Front End Tool: Swing
Operating System: Windows 98.

11

4.3 Software Environment


WHAT IS JAVA?

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


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

Architecture-neutral

Object-oriented

Portable

Distributed

High-performance

Interpreted

multithreaded

Robust

Dynamic

Secure
Java is also unusual in that each Java program is both compiled and
interpreted. With a compile you translate a Java program into an
intermediate language called Java bytecodes the platform-independent
code instruction is passed and run on the computer.
Compilation happens just once; interpretation occurs each time the
program is executed. The figure illustrates how this works.

Interpreter

Java
Program

Compilers

My Program

You can think of Java byte codes as the machine code instructions for
the Java Virtual Machine (Java VM). Every Java interpreter, whether its 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.

12

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.
JAVA PLATFORM
A platform is the hardware of software environment in which
a program runs. The Java platform differs from most other platforms in that
its a software only platform that runs on the top of other, hardware-based
platform. Most other platforms are described as a combination of hardware
and operating system.
The Java platform has two components:
The Java Virtual Machine (Java VM)
The Java Application Programming Interface (Java API)
Youve already been introduced to the Java VM. Its 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 (package) of related
components. The next sections, what can Java do? Highlights each area
of functionally provided by the package in the Java API.
The following figure depicts a Java program, such as an
application or applet, thats running on the Java platform. A special kind of
application known

as a server serves and supports clients on a network. Examples of the


servers include Web Servers, proxy servers, mail servers, print servers,
and boot servers. Another specialized program is a Servlet. Servlets are
similar to applets in that they are runtime extensions of the application.
Instead of working in browsers, though, servlets run with in Java Web
Servers, configuring of tailoring the server.

13

How does the Java API support all of these kinds of


programs? With packages of software components that provide a wide
range of functionality. The API is the API included in every full
implementation of the platform.
The core API gives you the following features:
The Essentials: Objects, Strings, threads, numbers, input and output,
datastructures, system properties, date and time, and so on.
Applets: The set of conventions used by Java applets.
Networking: URLs TCP and UDP sockets and IP addresses.
Internationalization: Help for writing programs that can be localized for users.
Worldwide programs can automatically adapt to specific
locates and be displayed in the appropriate language.
JAVA PROGRAM

Java API

Java Virtual Machine

Java Program

Hard Ware

API and Virtual Machine insulates the Java program from


hardware dependencies. As a platform-independent environment, Java
can be a bit slower than native code. However, smart compilers, well-tuned
interpreters, and Just-in-time-byte-code compilers can bring Javas
performance close to the native code without threatening portability.
WHAT CAN JAVA DO?

However, Java is not just for writing cut, entertaining


applets for the World Wide Web (WWW). Java is a general purpose, highlevel programming language and a powerful software platform. Using the
fineries Java API,you can write many types of programs.

14

The most common types of program are probably


applets and application, where a Java application is a standalone program
that runs directly on the Java platform.
Security:
Both low-level and high-level, including electronic signatures,
public/private key management, accesses control, and certificate.

Networking
Introduction

This article is about a client/server multi-threaded socket class. The


thread is optional since the developer is still responsible to decide if
needs it. There are other Socket classes here and other places over the
Internet but none of them can provide feedback (event detection) to your
application like this one does. It provides you with the following events
detection: connection established, connection dropped, connection failed
and data reception (including 0 byte packet).

Description
This article presents a new socket class which supports both TCP
and UDP communication. But it provides some advantages compared to
other classes that you may find here or on some other Socket
Programming articles. First of all, this class doesn't have any limitation
like the need to provide a window handle to be used. This limitation is
bad if all you want is a simple console application. So this library doesn't
have such a limitation. It also provides threading support automatically
for you, which handles the socket connection and disconnection to a
peer. It also features some options not yet found in any socket classes
that I have seen so far. It supports both client and server sockets. A
server socket can be referred as to a socket that can accept many
connections. And a client socket is a socket that is connected to server
socket. You may still use this class to communicate between two
applications without establishing a connection. In the latter case, you
will want to create two UDP server sockets (one for each application).
This class also helps reduce coding need to create chat-like applications
and IPC (Inter-Process Communication) between two or more
applications (processes). Reliable communication between two peers is
also supported with TCP/IP with error handling. You may want to use
the smart addressing operation to control the destination of the data
being transmitted (UDP only). TCP operation of this class deals only
with communication between two peers.

15

Analysis of Network Client Server

TCP/IP stack
The TCP/IP stack is shorter than the OSI one:

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


a connectionless protocol.

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

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.

16

TCP
TCP supplies logic to give a reliable connection-oriented protocol above
IP. It provides a virtual circuit that two processes can use to communicate.

Internet addresses
In order to use a service, you must be able to find it. The Internet uses an
address scheme for machines so that they can be located. The address is a 32
bit integer which gives the IP address. This encodes a network ID and more
addressing. The network ID falls into various classes according to the size of
the network address.

Network address
Class A uses 8 bits for the network address with 24 bits left over for
other addressing. Class B uses 16 bit network addressing. Class C uses 24 bit
network addressing and class D uses all 32.

Subnet address
Internally, the UNIX network is divided into sub networks. Building 11
is currently on one sub network and uses 10-bit addressing, allowing 1024
different hosts.

Host address
8 bits are finally used for host addresses within our subnet. This places a
limit of 256 machines that can be on the subnet.

Total address

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

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

17

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 ReadFile and WriteFile 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.
Create a server socket that listens for a client to connect

socket(int af, int type, int protocol)

This method creates the socket


bind(SOCKET s, const struct sockaddr FAR * name, int
namelen)

Associates a local address with a socket This routine is used on an


unconnected datagram or stream socket, before subsequent connects or
listens. When a socket is created with socket, it exists in a name space
(address family), but it has no name assigned. bind establishes the local
association (host address/port number) of the socket by assigning a local
name to an unnamed socket. In the Internet address family, a name consists
of several components. For SOCK_DGRAM and SOCK_STREAM, the name
consists of three parts: a host address, the protocol number (set implicitly to
UDP or TCP, respectively), and a port number which identifies the
application. If an application does not care what address is assigned to it, it
may specify an Internet address equal to INADDR_ANY, a port equal to 0, or
both. If the Internet address is equal to INADDR_ANY, any appropriate
network interface will be used; this simplifies application programming in
the presence of multi- homed hosts. If the port is specified as 0, the
Windows Sockets implementation will assign a unique port to the
application with a value between 1024 and 5000. The application may use
getsockname after bind to learn the address that has been assigned to it, but
note that getsockname will not necessarily fill in the Internet address until
the socket is connected, since several Internet addresses may be valid if the
host is multi-homed. If no error occurs, bind returns 0. Otherwise, it returns

18

SOCKET_ERROR, and
WSAGetLastError.

a specific error code may be retrieved by calling

listen(SOCKET s, int backlog )

Establishes a socket to listen to a incoming connection To accept


connections, a socket is first created with socket, a backlog for incoming
connections is specified with listen, and then the connections are accepted
with accept. listen applies only to sockets that support connections, i.e.
those of type SOCK_STREAM. The socket s is put into "passive'' mode where
incoming connections are acknowledged and queued pending acceptance by
the process. This function is typically used by servers that could have more
than one connection request at a time: if a connection request arrives with
the queue full, the client will receive an error with an indication of
WSAECONNREFUSED. listen

attempts to continue to function rationally when there are no available


descriptors. It will accept connections until the queue is emptied. If
descriptors become available, a later call to listen or accept will re-fill the
queue to the current or most recent "backlog'', if possible, and resume
listening for incoming connections.
accept(SOCKET s, struct sockaddr FAR * addr, int FAR *
addrlen)

This routine extracts the first connection on the queue of pending


connections on s, creates a new socket with the same properties as s and
returns a handle to the new socket. If no pending connections are present on
the queue, and the socket is not marked as non- blocking, accept blocks the
caller until a connection is present. If the socket is marked non-blocking and
no pending connections are present on the queue, accept returns an error as
described below. The accepted socket may not be used to accept more
connections. The original socket remains open. The argument addr is a
result parameter that is filled in with the address of the connecting entity, as
known to the communications layer. The exact format of the addr parameter
is determined by the address family in which the communication is
occurring. The addrlen is a value-result parameter; it should initially
contain the amount of space pointed to by addr; on return it will contain the
actual length (in bytes) of the address returned. This call is used with
connection-based socket types such as SOCK_STREAM. If addr and/or
addrlen are equal to NULL, then no information about the remote address of
the accepted socket is returned.
closesocket(SOCKET s)

closes a socket

19

Making client connection with server


In order to create a socket that connects to an other socket uses most of
the functions from the previous code with the exception of a struct called
HOSTENT

HOSTENT:

This struct is used to tell the socket to which computer and port to
connect to. These struct can appear as LPHOSTENT, but it actually means that
they are pointer to HOSTENT.

Client key function


Most of the functions that have been used for the client to connect to the
server are the same as the server with the exception of a few. I will just go
through the different functions that have been used for the client.
gethostbyname(const char* FAR name)
gethostbyname returns a pointer to a hostent structure as described
under gethostbyaddr. The contents of this structure correspond to the
hostname name. The pointer which is returned points to a structure which is
allocated by the Windows Sockets implementation. The application must
never attempt to modify this structure or to free any of its components.
Furthermore, only one copy of this structure is allocated per thread, and so
the application should copy any information which it needs before issuing
any other Windows Sockets API calls. A gethostbyname implementation
must not resolve IP address strings passed to it. Such a request should be
treated exactly as if an unknown host name were passed. An application
with an IP address string to resolve should use inet_addr to convert the
string to an IP address, then gethostbyaddr to obtain the hostent
structure.

Part 2 - Send / recieve


Up to this point we have managed to connect with our client to the
server. Clearly this is not going to be enough in a real-life application. In
this section we are going to look into more details how to use the send/recv
functions in order to get some communication going between the two
applications.
Factually this is not going to be difficult because most of the hard work
has been done setting up the server and the client app. before going into the
code we are going to look into more details the two functions
send(SOCKET s, const char FAR * buf, int len, int flags)
send is used on connected datagram or stream sockets and is used to
write outgoing data on a socket. For datagram sockets, care must be taken
not to exceed the maximum IP packet size of the underlying subnets, which

20

is given by the iMaxUdpDg element in the WSAData structure returned by


WSAStartup. If the data is too long to pass atomically through the
underlying protocol the error WSAEMSGSIZE is returned, and no data is
transmitted.
recv(SOCKET s, const char FAR * buf, int len, int flags)

For sockets of type SOCK_STREAM, as much information as is currently


available up to the size of the buffer supplied is returned. If the socket has
been configured for in- line reception of out-of-band data (socket option
SO_OOBINLINE) and out-of-band data is unread, only out-of-band data will
be returned. The application may use the ioctlsocket SIOCATMARK to
determine whether any more out-of-band data remains to be read.

part 3 - Read unknow size of data from client


Us mentioned earlier in part 2, we are noe going to expand on the way
that we receive data. The problem we had before is that if we did not know
the size of data that we where expecting, then the would end up with
problems.
In order to fix this here we create a new function that receive a pointer to
the client socket, and then read a char at the time, placing each char into a
vector until we find the '\n' character that signifies the end of the message.
This solution is clearly not a robust or industrial way the read data from
one socket to an other, because but its a way to start reading unknown length
strings. the function will be called after the accept method

21

5. SYSTEM DESIGN
5.1 DATA FLOW DIAGRAM
The data flow diagrams are very helpful in determining the flow of data in an
application.

User

Route Discover
Encryp
t
Check
node

Core Node

Recore

Decryp
t

Transmission

22

IS MY.IPADDR
>
COREIPADDR

23

EXPAND RING SEARCH

HAS
DISCOVERY
TIMER
EXPIRED

RECEIVED
JOIN_ACK
MESSAGE

INCREMENT HOPCOUNT

24

25

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

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

Integration testing
Integration tests are designed to test integrated software components to determine if
they actually run as one program. Testing is event driven and is more concerned with the
basic outcome of screens or fields. Integration tests demonstrate that although the components
were individually satisfaction, as shown by successfully unit testing, the combination of
components is correct and consistent. Integration testing is specifically aimed at exposing
the problems that arise from the combination of components.

Functional test

26

Functional tests provide a systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation , and user
manuals.
Functional testing is centered on the following items:
Valid Input

: identified classes of valid input must be accepted.

Invalid Input

: identified classes of invalid input must be rejected.

Functions

: identified functions must be exercised.

Output

: identified classes of application outputs must be exercised.

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


Organization and preparation of functional tests is focused on requirements, key functions,
or special test cases. In addition, systematic coverage pertaining to identify
Business process flows; data fields, predefined processes, and successive processes must be
considered for testing. Before functional testing is complete, additional tests are identified and
the effective value of current tests is determined.

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

White Box Testing


White Box Testing is a testing in which in which the software tester has knowledge of
the inner workings, structure and language of the software, or at least its purpose. It is
purpose. It is used to test areas that cannot be reached from a black box level .

Black Box Testing


Black Box Testing is testing the software without any knowledge of the inner workings,
structure or language of the module being tested . Black box tests, as most other kinds of
tests, must be written from a definitive source document, such as specification or
requirements document, such as specification or requirements document. It is a testing in
which the software under test is treated, as a black box .you cannot see into it. The test
provides inputs and responds to outputs without considering how the software works.

27

6.1 Unit Testing:


Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be conducted as
two distinct phases.

Test strategy and approach


Field testing will be performed manually and functional tests will be written in detail.
Test objectives

All field entries must work properly.

Pages must be activated from the identified link.

The entry screen, messages and responses must not be delayed.

Features to be tested

Verify that the entries are of the correct format

No duplicate entries should be allowed

All links should take the user to the correct page.

28

6.2 Integration Testing


Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by interface
defects.
The task of the integration test is to check that components or software applications,
e.g. components in a software system or one step up software applications at the company
level interact without error.
Integration testing for Database Synchronization:

Testing the links that call the Change Username & password, Migration and
Synchronization screens etc.

The username should be retained throughout the application in the form of hidden
variables or by using cookies.

If the login user does not have enough privileges to invoke a screen, the link should
be disabled.

Any modification in the Master server should be reflected in the Slave server.

The XML file should retrieve only the records, which have been modified.

Test Results: All the test cases mentioned above passed successfully. No defects encountered.

6.3 Acceptance Testing


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

Users have separate roles to modify the database tables.

The timestamp for all insertions and updating should be maintained.

Users should have the ability to modify the privilege for a screen.

Once the Synchronization starts, the Master server or Slave Server should not be
stopped without notifying the other.

29

The XML file should be generated in short time, i.e., before the next modification
occurs.

Test Results: All the test cases mentioned above passed successfully. No defects encountered.

30

7. IMPLEMENTATION
Implementation is the stage in the project where the theoretical design is turned Into a
working system and is giving confidence on the new system for the users , which it will work
efficiently and effectively. It involves careful planning ,investigation of the current System
and its constraints on implementation, design of methods to achieve the change over, an
evaluation, of change over methods. Apart from planning major task of preparing the
implementation are education and training of users. The more complex system being
implemented, the more involved will be the system analysis and the design effort required just
for implementation.
An implementation co-ordination committee based on policies of individual organization
has been appointed. The implementation process begins with preparing a plan for the
implementation of the system. According to this plan, the activities are to be carried out,
discussions made regarding the equipment and resources and the additional equipment has to
be acquired to implement the new system.
Implementation is the final and important phase, the most critical stage in achieving a
successful new system and in giving the users confidence. That the new system will work be
effective .The system can be implemented only after through testing is done and if it found to
working according to the specification . This method also offers the greatest security since
the old system can take over if the errors are found or inability to handle certain type of
transactions while using the new system.

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

Preparation of user and system documentation

Conducting user training with demo and hands on

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

31

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

Performance:
Database connection is through a connection pool mechanism. Database Connections
are being created as and when required, instead they are retrieved from a pool of
connections. This way the transactions are faster in execution.
Java standard API objects are used wherever possible to hold data.
The second database acts as a backup server to improve performance and survive
database crashes.

Security:

Application level security using user id and password.

Secured Socket Layer.

All passwords are kept encrypted as objects in a file.

Failure of one database does not affect the data in the other database.

7.1. Modules

Expand Ring Search Algorithm


Core Resolution Algorithm
Tree Creation Algorithm
Threshold Cryptography

7.2. Module Description


7.2.1. Expand Ring Search Algorithm
To initiate the Route Discovery, node transmits a "Route Request" as a
single local broadcast packet, which is received by (approximately) all nodes
currently on the transmission range of, including node.

Each Route Request

identifies the initiator and target of the Route Discovery, and also contains a unique
request identification determined by the initiator of the Request. Each Route Request
also contains a record listing the address of each intermediate node through which
this particular copy of the Route Request has been forwarded.

32

7.2.2. Core Resolution Algorithm


Core Finding
If the core node and user defined destination node are same then
it transmit the file to the corresponding destination node.
After route discovery, to find the core node of the system then
compares core node and user defined node in core class

Re-Core Selection
To select the re-core node address for finding the destination
address.
Re-Core selection is used when the core process is not able to
find the destination address.

7.2.3. Tree Creation Algorithm


When the intermediate node is fail, this process will execute and
choose the another intermediate node for transmission. The failure node is
identified by route request of corresponding end host, then the user to choose
the another node as intermediate node so that the node failure will not affect
the whole network

7.2.4. Threshold Cryptography


Threshold cryptography is the process of encrypting the plain text
into cipher text and decrypting the cipher text into original plain text
using the fixed key and math function. Converted data code can be
securely transmitted over a network. Here the actual content is
converted into Hex-code for transmission

33

8. CONCLUSION
Terminode routing aims to support location-based routing on
irregular topologies with mobile nodes. It achieves its goal by
combining a location-based routing method with a link state-based
mechanism. Further, it introduces the concept of anchors, which are
geographical points imagined by sources for routing to specific
destinations, and proposes low overhead methods for computing
anchors. Last, a
special form of restricted search mode (Restricted Local Flooding,
RLF), solves problems due to the inaccuracy of location information,
in particular for control packets. The performance analysis shows
that, in large mobile ad hoc networks, terminode routing performs
better than MANET-like, or existing location-based routing protocols.
It does so by maintaining its routing overhead low and by
efficiently solving location inaccuracies.

34

Future Enhancement
A Mobile Gateway has been developed that uses a cellular network for the
connection. It handles the challenges that had to be solved to realize this
interconnection and describes a way how to connect two IPv6 networks over an IPv4
infrastructure. Different levels of mobility are described. Mobility within the ad hoc
domain and between different Mobile Gateways of this ad hoc domain is handled
using an enhanced AODV routing protocol. Mobility of the whole ad hoc network is
handled by the mobility mechanisms of the cellular network and finally the seamless
mobility of single ad hoc nodes is realized using two interfaces and a modified
MobileIPv6 implementation.

35

9. BIBLIOGRAPHY
Good Teachers are worth more than thousand books, we have
them in Our Department

References Made From :


Herbert Schildt, Java 2 - The Complete Reference, IVth Edition
JavaAPI http://java.sun.com

Sites Referred:
http://java.sun.com
www.beta.ece.ucsb.edu
www.ietf.org
www.ecst.csuchoco.edu

36

10. SAMPLE SCREENS


Front-end snapshot of the source node

37

Browsing the file to be sent to destination

38

Sending selected file to destination

39

Encrypted form of the file

40

Finding the core node to send data

41

Decrypted form of the file

42

Front-end snapshot of destination node

43

Receiving data at destination node

44

Sample Code

45

Core.java
import java.io.*;
import java.net.*;
import java.util.*;
class Core
{
static String g1="";
static String n=" ";
static String core="";
static String nul=null;
static File fk;
public static void main(String a[])
{
}
static String findCore() throws Exception
{
String s="";
String k="";
InetAddress in;
TreeSet v=new TreeSet();
String b="";
BufferedReader bf=new BufferedReader(new FileReader("f2.txt"));
while((s=bf.readLine())!=null)
{
try
{
in=InetAddress.getByName(s);
b=in.getHostAddress();
v.add(b);
System.out.println("Inetaddress : "+in);
System.out.println("Address : "+b);
}
catch(Exception e)
{
System.out.println("Error in finding the core ");
continue;
}
}
bf.close();
core=(String)v.last();
System.out.println("The Core Node's Address Is : "+core);
return core;
}
static void sendFileToCore(String core,String source,String destination,String msg)
throws Exception
{
46

String str="",str1="";
//FileReader fr=new FileReader(f1);
//BufferedReader br=new BufferedReader(fr);
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@"+core);
Socket s=new Socket(core,8888);
ObjectOutputStream obop=new
ObjectOutputStream(s.getOutputStream());
obop.writeObject("file");
obop.writeObject(source);
System.out.println("The Source address is : "+source);
obop.writeObject(destination);
System.out.println("The destined address is : "+destination);
obop.writeObject(msg);
obop.writeObject(nul);
}
//s.close();
public static String met1()
{
int i;
int b[]=new int[5000];
int a[]=new int[5000];
String g=" ";
char x[]=new char[5000];
char d,s;
String s1;
try
{
n=FileOpen.jta.getText();
int len=n.length();
System.out.println("StringLength:"+len);
System.out.print("Ascii-CODE:");
for(i=0;i<len;i++)
{
int aa= n.charAt(i);
System.out.print("\t"+ aa);
a[i]=aa;
}
System.out.print("\n");
System.out.print("HEX-CODE:");
47

for(i=0;i<len;i++)
{
g=" ";
b[i]=a[i]%16;
a[i]=a[i]/16;
if(a[i]==10)
{
s='A';
g=g+s;
}
else if(a[i]==11)
{
s='B';
g=g+s;
}
else if(a[i]==12)
{
s='C';
g=g+s;
}
else if(a[i]==13)
{
s='D';
g=g+s;
}
else if(a[i]==14)
{
s='E';
g=g+s;
}
else if(a[i]==15)
{
48

s='F';
g=g+s;
}
else
{
s=(char) a[i];
g=g+a[i];
}
if(b[i]==10)
{
s='A';
g=g+s;
System.out.print(g.trim());
}
else if(b[i]==11)
{
s='B';
g=g+s;
System.out.print(g.trim());
}
else if(b[i]==12)
{
s='C';
g=g+s;
System.out.print(g.trim());
}
else if(b[i]==13)
{
s='D';
g=g+s;
System.out.print(g.trim());
}
else if(b[i]==14)
{
s='E';
g=g+s;
49

System.out.print(g.trim());
}
else if(b[i]==15)
{
s='F';
g=g+s;
System.out.print(g.trim());
}
else
{
s=(char) b[i];
g=g+b[i];
System.out.print(g.trim());
}
g1=g1+g.trim();
}
FileWriter fr=new FileWriter("encc.txt");
BufferedWriter bw=new BufferedWriter(fr);
bw.write(g1,0,g1.length());
bw.flush();
//fk=new File("encc.txt");
}
catch(Exception e)
{
System.out.println(e);
}
return(g1);
//System.out.println("Struibg"+g1);
}
}
Destination.java
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

50

public class Destination extends JFrame implements ActionListener


{
JTabbedPane tp ;
JLabel jl,jl1,jl2,jL;
JButton jb,jb1,jb2;
JTextField tf1,tf2,tfd,tfd1;
static JTextArea tf,ta1;
JScrollPane sp,sp1;
static String g1=" ";
static String n,n1,n2;
static byte str[];
static byte realSig[];
static byte realSig1[];
static String y="";
static String str6,str61,str2,str12,str13;
static String t,st="",st1="",vj="";
public Destination()
{
super("Transaction");
setSize(500,530);
Container c = getContentPane();
JPanel jp = new JPanel();
jp.setLayout(null);
jl = new JLabel("Sender Name ",JLabel.LEFT);
jL = new JLabel("Receiver Name ",JLabel.LEFT);
tfd = new JTextField(15);
tfd1 = new JTextField(15);
tf = new JTextArea(20,40);
sp = new JScrollPane(tf);
jb= new JButton("OPEN");
jp.add(jl);
jp.add(tfd);
jp.add(jL);
jp.add(tfd1);
jp.add(sp);
jp.add(jb);
jl.setBounds(25,10,150,25);
tfd.setBounds(150,10,150,25);
jL.setBounds(25,40,150,25);
tfd1.setBounds(150,40,150,25);
sp.setBounds(25,70,450,350);
jb.setBounds(220,425,75,25);
jp.setVisible(true);
JPanel jp1 = new JPanel();
jp1.setLayout(null);
jl1 = new JLabel("Sender Name ",JLabel.LEFT);
jl2 = new JLabel("Receiver Name ",JLabel.LEFT);
51

tf1 = new JTextField(15);


tf2 = new JTextField(15);
ta1 = new JTextArea(20,40);
sp1 = new JScrollPane(ta1);
jb2= new JButton("Retrive");
jl1.setBounds(25,10,150,25);
tf1.setBounds(150,10,150,25);
jl2.setBounds(25,40,150,25);
tf2.setBounds(150,40,150,25);
sp1.setBounds(25,70,450,350);
jb2.setBounds(220,425,75,25);
jb.addActionListener(this);
jb2.addActionListener(this);
jp1.add(jl1);
jp1.add(tf1);
jp1.add(jl2);
jp1.add(tf2);
jp1.add(sp1);
jp1.add(jb2);
jp1.setVisible(true);
tp = new JTabbedPane();
tp.addTab("Message",null,jp,"Retrive the Message here");
tp.addTab("File",null,jp1,"Retrive the File Name here");
c.add(tp);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
setResizable(false);
}
public static void main(String arg[])throws Exception
{
Destination rm = new Destination();
}
public static void ServSoc(String str2,String sw,String sw1)
{
try
{
char a[]=new char[50000];
char res[]=new char[9];
char s1[]=new char[5];
String w =new String();
String r =new String();
int i,j=0,d=1,h,n,l=8,c=0,l2=0,l1=0;
String t,st="",st1="";
str6=sw;
str61=sw1;
52

System.out.println("Enter the Hex-Code:");


System.out.println(str2);
int len=str2.length();
System.out.print("String Length:");
System.out.println(len);
/* Converting Hexcode into Bits

*/

for(i=0;i<len;i++)
{
char aa= ((str2).charAt(i));
a[i]=aa;
if(a[i]=='A')
{
st="1010";
st1=st;
}
else if(a[i]=='B')
{
st="1011";
st1=st;
}
else if(a[i]=='C')
{
st="1100";
st1=st;
}
else if(a[i]=='D')
{
st="1101";
st1=st;
}
else if(a[i]=='E')
{
st="1110";
st1=st;
}
else if(a[i]=='F')
{
st="1111";
st1=st;
}
else if(a[i]=='0')
{
st="0000";
st1=st;
}
else if(a[i]=='1')
{
st="0001";
53

st1=st;
}
else if(a[i]=='2')
{
st="0010";
st1=st;
}
else if(a[i]=='3')
{
st="0011";
st1=st;
}
else if(a[i]=='4')
{
st="0100";
st1=st;
}
else if(a[i]=='5')
{
st="0101";
st1=st;
}
else if(a[i]=='6')
{
st="0110";
st1=st;
}
else if(a[i]=='7')
{
st="0111";
st1=st;
}
else if(a[i]=='8')
{
st="1000";
}
else if(a[i]=='9')
{
st="1001";
}
w=w+st;
}
char w_ch[]=w.toCharArray();
String x=w.toString();
System.out.print(x);
System.out.println("Length:"+len);
/* Converting Hexcode into Character */

54

try
{
if(len==8)
{
int k;
k=len;
for(j=k-1;j>=0;j--)
{
c=c+(w_ch[j]-48)*d;
y=y+c;
d=d*2;
}
System.out.print("\n");
vj=vj+(char)c;
//System.out.print((char)c);
}

else
{
int k;
for(i=0;i<5000;i++)
{
c=0; d=1;
k=i*8;
for(j=k+7;j>=k;j--)
{
c=c+(w_ch[j]-48)*d;
y=y+c;
d=d*2;
}
vj=vj+(char)c;
//System.out.print((char) c);
}
}
}
catch(Exception e)
{
}
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("the file content is :"+vj);
System.out.println("File Ends *********** ");
ta1.append(vj);
55

public void actionPerformed(ActionEvent e)


{
if(e.getSource() == jb2)
{
tf1.setText(str6);
tf2.setText(str61);
ta1.setText(vj);
}
else if(e.getSource() == jb)
{
JOptionPane.showMessageDialog(null, "Signature are
Verified","Verify Sign", JOptionPane.ERROR_MESSAGE);
tfd.setText(str6);
tfd1.setText(str61);
System.out.print("FileContent"+vj);
tf.setText(vj);
}
}
}
FileOpen.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
class FileOpen extends JFrame
{
JLabel jl1;
JLabel jl2;
JLabel jl3;
JLabel jl5;
JButton jb1;
JButton jb2;
JButton jb3;
JTextField jt1;
JTextField jt2;
String msg="";
static JTextArea jta;
JScrollPane jsp;
Container c;
ImageIcon ii;
JLabel jl4;
56

String str="";
Core co;
ReCore rc;
String pass="";
String path="";
String coreaddr="";
String core="";
String nextcore="";
String dest="";
String dest1="";
File f;
File fg;
FileOpen()
{
jl1=new JLabel("Plz Enter The Destination Name ");
jl2=new JLabel("Plz Choose File ");
jl3=new JLabel("File Name Will Be Displayed Here..");
jl5=new JLabel("Next Core Address ");
jb1=new JButton("Send");
jb2=new JButton("Reset");
jb3=new JButton("Browse..");
jt1=new JTextField(10);
jt2=new JTextField(10);
ii=new ImageIcon("Multi.gif");
jl4=new JLabel(ii);
jta=new JTextArea();
jsp=new JScrollPane(jta);
c=getContentPane();
c.setLayout(null);
c.add(jl1);
c.add(jt1);
c.add(jl2);
c.add(jl3);
c.add(jb3);
c.add(jb1);
c.add(jb2);
c.add(jsp);
c.add(jl4);
c.add(jl5);
c.add(jt2);
jl1.setBounds(70,100,200,25);
jt1.setBounds(300,100,100,25);
jl2.setBounds(70,135,200,25);
jt2.setBounds(300,135,100,25);
jb3.setBounds(300,170,100,25);
jsp.setBounds(410,100,280,400);
jb1.setBounds(150,225,100,25);
jb2.setBounds(300,225,100,25);
jl4.setBounds(700,50,250,500);
57

jl3.setBounds(70,400,600,25);
jl5.setBounds(70,500,600,25);
setSize(800,800);
setVisible(true);

jb3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae)
{
JFileChooser jf=new JFileChooser();
int m=jf.showOpenDialog(null);
if(m==JFileChooser.APPROVE_OPTION)
{
f=jf.getSelectedFile();
str=f.getPath();
path=f.getAbsolutePath();
jl3.setText("U Have Selected The File
Named \""+str+"\""+"from "+path);
try
{
FileInputStream fis=new FileInputStream(str);
byte b[]=new byte[fis.available()];
jt2.setText(str);
fis.read(b);
String str1=new String(b);
jta.setText(str1);
}
catch(Exception ui){}
}
}
} );
jb1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae)
{
co=new Core();
rc=new ReCore();
try {
coreaddr=co.findCore();
jl3.setText("The Core Address is : "+coreaddr);
String
d=((InetAddress.getLocalHost()).getHostAddress());
System.out.println("The local address is : "+d);
dest=jt1.getText();
dest1=jt2.getText();
jl5.setText(dest);
58

pass=co.met1();
if(coreaddr.equals((InetAddress.getLocalHost()).getHostAddress()))
{
// nextcore = ReCore.sss;
nextcore=rc.reqCore();
jl5.setText("The Next Mesh Core is :"+nextcore);
co.sendFileToCore(nextcore,
(InetAddress.getLocalHost()).getHostAddress(),dest,pass);
//Thread.sleep(1000);
co.sendFileToCore(nextcore,
(InetAddress.getLocalHost()).getHostAddress(),dest1,pass);
}
else
{
co.sendFileToCore(coreaddr,
(InetAddress.getLocalHost()).getHostAddress(),dest,pass);
//Thread.sleep(1000);
co.sendFileToCore(coreaddr,
(InetAddress.getLocalHost()).getHostAddress(),dest1,pass);
System.out.println("Successful transfer of file
");
jl5.setText("The Next Mesh Core
is :"+coreaddr);
}
}
catch(Exception e) { System.out.println(e); }
}
} );
}
public static void main(String a[])
{
new FileOpen();
}
}
Main_server.java
import java.io.*;
import java.net.*;
import java.util.*;
class Main_Server
{
59

static String query="";


static String str="";
static String addr="";
static String source="";
static String destination="";
static String f="";
static TreeSet v;
static File ff;
static InetAddress in;
static String sst="";
static String b="";
static boolean bool=false;
static boolean boolea=false;
static ReCore re;
static String neaddr="";
static Core co;
static String pass="";
Main_Server()
{
}
public static void main(String a[])
{
try {
ServerSocket ss=new ServerSocket(8888);
while(true)
{
System.out.println("Waiting ");
Socket s=ss.accept();
System.out.println("Connected ");
while(true)
{
InputStream ins=s.getInputStream();
OutputStream ous=s.getOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(ous);
ObjectInputStream ois=new ObjectInputStream(ins);
//DataOutputStream dos=new DataOutputStream(ous);
co=new Core();
v=new TreeSet();
System.out.println("B4 read ");
String fd=(String)ois.readObject();
System.out.println("OBJECTXxxxxxxxxxxxxx"+fd);
if(fd.equals("request"))
{
System.out.println("Req Rec");
addr=co.findCore();
60

System.out.println("Core Address : "+addr);


oos.writeObject(addr);
break;
}
if(fd.equals("file"))
{
System.out.println("File transfer is requested ");
source=(String)ois.readObject();
destination=(String)ois.readObject();
System.out.println("Source :"+source);
System.out.println("Destination :"+destination);
FileWriter fw=new FileWriter("encc.txt");
BufferedWriter bw=new BufferedWriter(fw);
pass=(String)ois.readObject();
Pack p=new Pack();
p.Pack1(pass);
System.out.println("The Enc File is "+pass);
bw.write(pass,0,pass.length());
bw.flush();
ff=new File("encc.txt");
/*while((f=(String)ois.readObject())!=null)
{
bw.write(f,0,f.length());
bw.flush();
bw.newLine();
System.out.println(f);
}*/
//fw.close();
//bw.close();
String
inet=(InetAddress.getLocalHost()).getHostName();
System.out.println("The local address is :"+inet);
System.out.println("The destined address is
ddddddddddd:"+destination);
if(destination.equalsIgnoreCase(inet))
{
System.out.println("Destination is
myself*******************************gf ");
new Destination();
Destination.ServSoc(pass,source,destination);
System.out.println("Destination is myself ");
bool=true;
break;
//s.close();
}
else if(!bool)
{
System.out.println("Boolean ");
61

BufferedReader bf=new BufferedReader(new


FileReader("f2.txt"));
while((sst=bf.readLine())!=null)
{
try
{
if(destination.equals(sst))
{
co.sendFileToCore(destination,source,destination,pass);
System.out.println("Success to destination ");
boolea=true;
break;
}
//System.out.println("Inetaddress : "+in+" "+sst);
//System.out.println("Address : "+b);
}
catch(Exception e)
{
System.out.println("Error in finding the core ");
continue;
}
}
}
if(!boolea && !bool)
{
//BufferedReader nn=new BufferedReader(new
FileReader("nextmesh.txt"));
re=new ReCore();
neaddr=re.reqCore();
co.sendFileToCore(neaddr,source,destination,pass);
break;
}
break;
}
}
}
}
catch(IOException ie)
62

{
System.out.println(ie);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Pack.java
class Pack
{
static String subs1;
static String sub="";
public static String Pack1(String g1)
{
int len=g1.length();
System.out.println("Length:"+len);
int len1=len/16;
System.out.println("Length1:"+len1);
int len2=len%16;
int k=16;
System.out.println("Length2:"+len2);
int c=0;
for(int l=0;l<len;l+=16)
{
if(k<=len-len2)
{
String subs = g1.substring(l,k);
subs1 = subs + "\n";
sub+=subs1;
c++;
k+=16;
}
}
if(len2>0)
{
System.out.println("inside ");
int g =(len- c*16);
System.out.println("Value:"+g);
subs1 = g1.substring(c*16,len);
sub+=subs1;
}
System.out.println("Packets:"+sub);
63

return sub;
}
}
Recore.java
import java.io.*;
import java.net.*;
class ReCore
{
static String add="";
public static void main(String a[])
{
try{
String add=reqCore();
System.out.println("aaaaaaaaaaaaaaaaaaaaaaaa"+add);
} catch(Exception e) { System.out.println(e); }
}
public static String reqCore() throws Exception
{
System.out.println("The local 1");
String h="";
System.out.println("Socket side ");
String s1="";
String s2="request";
String addr="";
Socket s;
String sss="";
boolean b=true;
//ObjectInputStream obip;
//ObjectOutputStream obop;
BufferedReader br;
BufferedWriter bw;
FileReader fr=new FileReader("NEXTMESH.txt");
BufferedReader brf=new BufferedReader(fr);
System.out.println("Socket side after file read ");
//System.out.println("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"+s1);
while((s1=brf.readLine())!=null)
{
if(b)
{
System.out.println("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"+s1);
sss = s1;
System.out.println("B4 try ");
try
{
64

s=new Socket(s1,8888);
System.out.println("after connection ");
InputStream is=s.getInputStream();
OutputStream os=s.getOutputStream();
//ObjectInputStream ois=new ObjectInputStream(is);
ObjectOutputStream oos=new ObjectOutputStream(os);
//os.write(1);
oos.writeObject("request");
ObjectInputStream obip=new
ObjectInputStream(s.getInputStream());
add=(String)obip.readObject();
b=false;
System.out.println("The Next Core Address :"+add);
}
catch(Exception e)
{
System.out.println(e);
}
}

}
return sss;

}
}

65

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