You are on page 1of 52

ABSTRACT

In most sensor systems the hubs are static. By and by, hub network is liable to
changes due to interruptions in remote correspondence, transmission force changes, or
loss of synchronization between neighboring hubs. Henceforth, even after a sensor is
mindful of its prompt neighbors, it should constantly keep up its view, a procedure we
call ceaseless neighbor revelation. In remote sensor system to make solid way integration
and bundle trade will take additional time furthermore require more power. Two systems
are dissected here to decrease time and keep up force utilization. One of the systems is
Continuous Neighbor Discovery, It will discover neighbor hub furthermore persistently
keep up a prompt neighbor hub view. Another is Link Assessment Method, It considers
probabilistic assurance of crash free parcel trade. Every sensor utilizing a straightforward
convention as a part of a direction push to lessen power utilization without expanding the
time needed to recognize concealed sensors. In this study we recognize contiguous
breakthrough amid sensor system introduction and consistent contiguous disclosure. We
concentrate on the recent and perspective it as a joint assignment of the considerable
number of hubs in every joined fragment.

1. INTRODUCTION

1
Spatially dispersed self-ruling sensors to screen physical or ecological conditions,
for example, temperature, sound, vibration, weight, movement or contaminations and to
helpfully go their information through the system to a fundamental area. The more
present day systems are bi-directional, additionally empowering control of sensor
movement. The WSN is assembled of "hubs" – from a couple to a few hundreds or even
thousands, where every hub is joined with one (or once in a while a few) sensors. In the
sensor system model considered in this paper, the hubs are set arbitrarily over the zone of
enthusiasm for giving proficient correspondence every sensor hub need to recognize their
prompt neighbors. A unique neighbor revelation plan ought to be utilized when the sensor
systems with low and unpredictable activity. This paper principally breaks down the
current neighbor disclosure plan and assets, for example, vitality, memory, and
computational pace and interchanges transmission capacity of WSN. Remote sensor
systems are "specially appointed" systems, which implies that the topology of the system
is not arranged, but rather must be chosen by the system hubs themselves. Numerous
major inquiries concerning remote impromptu systems stay unanswered. Among the
inquiries considered in this exposition are: To what degree is "layered systems
administration" agreeable for sensor systems? Is booking or controversy a superior
approach to control medium access in sensor systems? With what force ought to hubs in
the system transmit? Will hubs focus their neighbors, and provided that this is true, how?
The sensor system contains expansive number of sensor hubs. These sensor hubs may be
associated with one another within a system by any cross section. These sensor hubs can
sense different occasions delicately. A portion of the sensor hubs go about as switches and
portals to communicate the text or the record starting with one specific sensor hub then
onto the next sensor hub. To pass the information there will be high utilization of data
transfer capacity, vitality and even power. In systems with consistently substantial
movement, the sensors require not conjure any exceptional neighbor disclosure
convention amid ordinary operation. This is on account of any new hub, or a hub that has
lost integration to its neighbors, can hear its neighbors essentially by listening to the
channel for a brief while. Notwithstanding, for sensor systems with low and sporadic
2
activity, an uncommon neighbor disclosure plan ought to be utilized. Recognizing new
connections and hubs in sensor systems must be considered as a progressing procedure.
In the taking after dialog we recognize the location of new connections and hubs amid
instatement, i.e., when the hub is in Init state, and their recognition amid ordinary
operation, when the hub is in Normal state. The previous will be alluded to as starting
neighbor disclosure while the last will be alluded to as persistent neighbor revelation. In
such a case, the sensor can't correspond with the door and is in this manner exceptionally
restricted in performing its undertakings. The quick environment ought to be
distinguished at the earliest opportunity with a specific end goal to build up a way to the
door and add to the operation of the system. Subsequently, in this state, more broad
vitality utilization is legitimized. Interestingly, nonstop neighbor revelation is carried out
when the detector is as of now functional. At the point when the detector performs
nonstop neighbor revelation, it is now mindful of a large portion of its prompt contiguous
and can hence perform it together with these contiguous so as to expend less vitality.
Interestingly, starting contiguous disclosure must be executed by every sensor
independently. Presently we need to examine how the hubs are being found by
Continuous neighbor Discovery .In starting when the detector are in intial state , we
consider that all the hubs exhibit within a system are dynamic. Presently this detector hub
will hunt down some other detector hub which is dynamic. In the event that any detector
hub is dynamic at that amount of time, the first detector hub more than once transmits
information to the following dynamic sensor hub. The other detector hub answers back
by sending the acknowledge bundle to the previous detector hubs and in this two way
route correspondence between the detector hubs is being built up.

1.1 LITERATURE REVIEW

While numerous papers have been composed on the best way to minimize
vitality utilization in sensor systems, has not very many treated Express Between the

3
postponement and vitality parity. To the best of our insight, our work is the first to
propose the designation of diverse wake-up Frequencies hubs to as per your part in the
bundle sending procedure. Having respect to: the vitality dormancy tradeoff has been
widely concentrated on, as in sensor systems, and in different remote systems. In this
segment, we present related works, and contrast their models and results and our own. In
S-MAC convention parcel idleness created by intermittent dozing of moderate hubs is
minimized by synchronizing wake-up calendars neighbor hubs. The obligation cycles of
all hubs are equivalent and predefined. The convention is not proposed to ensure an upper
bound on end-to-end delay, however to minimize vitality utilization in the hubs. Another
paper proposes that minimize postponement utilizing exceptional arranging of the hubs
wake up periods. This paper expands another work by the same creators, where the hubs
are composed in a unidirectional tree. In the creators address the exchange off in the
middle of postponement and vitality in sensor systems from an alternate point of view.
They are searching for an ideal directing way from a source hub to the door, dry season
inactivity is minimized and vitality costs are not "too enormous." In their system model,
sensors haphazardly exchanging in the middle of rest and dynamic modes. Two options
are considered when a concentrated worldwide improvement methodology and a
conveyed methodology. Vitality productivity can be accomplished in different ways. Case
in point, vitality mindful directing when a steering way considering the vitality costs
what's more, the sensor's accessible vitality. In the quantity of bounces along the sending
way considered while recalling that transmission between close hubs are more vitality
productive, regardless of the possibility that the subsequent course is longer. The creators
utilize a arbitrary system model to demonstrate the vitality idleness throughput habit and
to locate the ideal transmission power for hubs in an impromptu system. As effectively
said, we don't understand the directing issues in our work. The plan proposed in, and
numerous others may be utilized for this reason. In the tradeoff in the middle of vitality
and inactivity is researched utilizing probabilistic processing? The bundles are not sent on
predefined courses, as they are in our model, however are sent rather to all neighbors in
dynamic mode. Subsequently, the system thickness and the obligation cycle ought to be
4
sufficiently high to guarantee that every parcel will at last achieve its destination. A
probabilistic investigation discovers the segment of time every hub is obliged to be in a
dynamic state with a specific end goal to guarantee that the parcel is conveyed to the door
on time. This model varies from our own in that our model does not utilize flooding and
expect that hubs are mindful of their neighbor's obligation cycles. The tradeoff in the
middle of vitality and inertness all in all remote systems was likewise mulled over in an
alternate connection. For sample, and explore this tradeoff when a system called "tweak
scaling" is utilized. The creators base their work on the perception that, in numerous
coding plans, the transmission of a parcel obliges a littler measure of vitality on the off
chance that it keeps going longer. Two calculations are proposed: a disconnected from the
net calculation that finds an ideal arrangement, and an on-line calculation that
approximates the ideal arrangement. The creators manage more broad setting, expecting
that every parcel may have an alternate due date and number of bits. In, this issue is
summed up by considering a total tree with parcels steered along the tree to the root. The
expense is distinctive for every hub due to the diverse measures of information to be sent.
The bundle ought to be conveyed to the sink inside of a restricted time period. The
creators propose a logged off calculation for an ideal arrangement whose running time
unpredictability is obscure, and an estimate calculation with pseudo-polynomial running
time that needs to know the system topology. The primary model is concentrated on in,
where a sensor picks one of the entryways while considering the vitality effectiveness of
the steering, vitality assets of the middle sensors, and burden adjusting. The same model
is moreover considered in, where the creators propose a few calculations for savvy
entryway situation keeping in mind the end goal to lessen inactivity and spare vitality.

2. SYSTEM ANALYSIS

2.1 EXISTING SYSTEM:

5
Initial neighbor discovery is usually performed when the sensor has no clue about the
structure of its immediate surroundings. In such a case, the sensor cannot communicate
with the gateway and is therefore very limited in performing its tasks.

Disadvantages of Existing System:


1. In networks with continuously heavy traffic.
2. Long-term process.
3. Greater expense of energy than required in our scheme.

2.2 PROPOSED SYSTEM:

We distinguish between neighbor discovery during sensor network initialization and


continuous neighbor discovery. We focus on the latter and view it as a joint task of all the

6
nodes in every connected segment. Each sensor employs a simple protocol in a
coordinate effort to reduce power consumption without increasing the time required to
detect hidden sensors.

Advantages of Proposed System:


1. Detect their immediate neighbors.
2. Message does not collide with another.
3. Every node discovers its hidden neighbors independently.

3. SYSTEM DESIGN
3.1 DATA FLOW DIAGRAM

7
3.3 PROJECT DESCRIPTION

8
Hence, distinguishing new connections and hubs in sensor systems must be considered as
a progressing procedure. In the taking after examination we recognize the
identification of new connections and hubs amid instatement, i.e., when the hub is
in Init state, and their identification amid ordinary operation, when the hub is in
Normal state. The previous will be alluded to as beginning neighbor disclosure
though the recent will be alluded to as constant neighbor revelation. While past
works location beginning neighbor disclosure and constant neighbor revelation as
comparable undertakings, to be performed by the same plan, we assert that
distinctive plans are needed, for the accompanying reasons: starting contiguous
revelation is normally performed when the detector has no idea about the structure
of its prompt environment. Thus, in this state, more broad vitality utilization is
supported. Interestingly, nonstop neighbor disclosure is performed when the sensor
is as of now operational. This is a long haul transform, whose enhancement is
significant for expanding system lifetime. Conversely, starting neighbor disclosure
must be executed by every sensor independently.

Module Description:
Client – Server:
Client – Server computing is distributed access. Server accepts requests for data from
client and returns the result to the client. By separating data from the computation
processing, the compute server’s processing capabilities can be optimized. Often clients
and servers communicate over a computer network on separate hardware, but both client
and server may reside in the same system.
Hidden link participate inside a segment:
This scheme is invoked when a new node is discovered by one of the segment nodes. The
discovering node issues a special SYNC message to all segment members, asking them to
wake up and periodically broadcast a bunch of HELLO messages. This SYNC message is
distributed over the already known wireless links of the segment. Thus, it is guaranteed to
be received by every segment node. By having all the nodes wake up .almost at the same
9
time. for a short period, we can ensure that every wireless link between the segment’s
members will be detected

Hidden link participate outside a segment:


A random wake-up approach is used to minimize the possibility of repeating collisions
between the HELLO messages of nodes in the same segment. Theoretically, another
scheme may be used, where segment nodes coordinate their wake-up periods to prevent
collisions and speed up the discovery of hidden nodes. Since the time period during
which every node wakes up is very short, and the HELLO transmission time is even
shorter, the probability that two neighboring nodes will be active at the same time.

Neighbor Discovery Model:


Neighbor Discovery is studied for general ad-hoc wireless networks. A node decides
randomly when to initiate the transmission of a HELLO message. If its message does not
collide with another HELLO, the node is considered to be discovered. The goal is to
determine the HELLO transmission frequency, and the duration of the neighbor discovery
process.

Algorithm:
AN EFFICIENT CONTINUOUS NEIGHBOR DISCOVERY ALGORITHM:
In this section we present an algorithm for assigning HELLO message frequency to the
nodes of the same segment. This algorithm is based on detecting all hidden links inside a
segment. Namely, if a hidden node is discovered by one of its segment neighbors, it is
discovered by all its other segment neighbors after a very short time. Hence, the
discovery of a new neighbor is viewed as a joint effort of the whole segment. One of the
three methods presented in Section is used to estimate the number of nodes participating
in this effort.
Suppose that node u is in initial neighbor discovery state, where it wakes up every TI
seconds for a period of time equal to H, and broadcasts HELLO messages. Suppose that
the nodes of segment S should discover u within a time period T with probability P.

10
4. TOOLS REQUIREMENTS SPECIFICATION
4.1 HARDWARE REQUIREMENTS

Processor : Pentium V

RAM : 4GB

Hard disk : 1000 GB or more

Monitor : VGA/SVGA

Keyboard : 104 Keys

Mouse : 2 buttons/ 3 buttons

4.2 SOFTWARE REQUIREMENTS

Front end : VB.NET 2010

4.3 SOFTWARE DESCRIPTION

INTRODUCTION TO THE .NET FRAMEWORK


The .NET Framework is a managed type-safe environment for application development
and execution. The .NET Framework manages all aspects of your program’s execution. It
11
allocates memory for the storage of data and instructions, grants or denies the appropriate
permissions to your application, initiates and manages application execution, and
manages the reallocation of memory from resources that are no longer needed. The .NET
Framework consists of two main components: the common language runtime and the
.NET Framework class library.
The common language runtime can be thought of as the environment that manages code
execution. It provides core services, such as code compilation, memory allocation, thread
management, and garbage collection. Through the common type system (CTS), it
enforces strict type-safety and ensures that code is executed in a safe environment by also
enforcing code access security.
The .NET Framework class library provides a collection of useful and reusable types that
are designed to integrate with the common language runtime. The types provided by
the .NET Framework are object-oriented and fully extensible, and they allow you to
seamlessly integrate your applications with the .NET Framework.

Languages and the .NET Framework

The .NET Framework is designed for cross-language compatibility, which means, simply,
that .NET components can interact with each other no matter what supported language
they were written in originally. So, an application written in Microsoft Visual Basic.NET
might reference a dynamic-link library (DLL) file written in Microsoft Visual C#, which
in turn might access a resource written in managed Microsoft Visual C++ or any other
.NET language. This language interoperability extends to full object-oriented inheritance.
A Visual Basic.NET class might be derived from a C# class, for example, or vice versa.
This level of cross-language compatibility is possible because of the common language
runtime. When a .NET application is compiled, it is converted from the language in
which it was written (Visual Basic. NET, C#, or any other .NET –compliant language) to
Microsoft Intermediate Language (MSIL or IL). MISL is a low-level language that the

12
common language runtime can read and understand. Because all, .NET executables and
DLLs exist as MSIL, they can freely interoperate.
The .NET Framework consists of two main components:
• COMMON LANGUAGE RUNTIME (CLR)
• CLASS LIBRARIES

COMMON LANGUAGE RUNTIME (CLR)

The CLR is described as the "execution engine" of .NET. It's this CLR that manages the
execution of programs. It provides the environment within which the programs run. The
software version of .NET is actually the CLR version.
WORKING OF CLR
When the .NET program is compiled, the output of the compiler is not an executable file
but a file that contains a special type of code called the Microsoft Intermediate
Language (MSIL). This MSIL defines a set of portable instructions that are independent
of any specific CPU. It's the job of the CLR to translate this Intermediate code into a
executable code when the program is executed making the program to run in any
environment for which the CLR is implemented. And that's how the .NET Framework
achieves Portability. This MSIL is turned into executable code using a JIT (Just In Time)
complier. The process goes like this, when .NET programs are executed, the CLR
activates the JIT complier. The JIT complier converts MSIL into native code on a demand
basis as each part of the program is needed. Thus the program executes as a native code
even though it is compiled into MSIL making the program to run as fast as it would if it is
compiled to native code but achieves the portability benefits of MSIL.
CLASS LIBRARIES
Class library is the second major entity of the .NET Framework. This library gives the
program access to runtime environment. The class library consists of lots of prewritten
code that all the applications created in VB .NET and Visual Studio .NET will use. The
code for all the elements like forms, controls and the rest in VB .NET applications
actually comes from the class library.
13
COMMON LANGUAGE SPECIFICATION (CLS)
If we want the code which we write in a language to be used by programs in other
languages then it should adhere to the Common Language Specification (CLS). The CLS
describes a set of features that different languages have in common. The CLS includes a
subset of Common Type System (CTS) which define the rules concerning data types and
ensures that code is executed in a safe.
Environment
Some reasons why developers are building applications using the .NET Framework:
• Improved Reliability
• Increased Performance
• Developer Productivity
• Powerful Security
• Integration with existing Systems
• Ease of Deployment
• Mobility Support
• XML Web service Support
• Support for over 20 Programming Languages
• Flexible Data Access
The CTS ensures type compatibility between .NET components. Because .NET
applications are converted to IL prior to deployment and execution, all primitive data
types are represented as .NET types. Thus a Visual Basic Integer and a C# int are both
represented in IL code as a system.Int32. Because both languages use a common type
system, it is possible to transfer data between components and avoid time-consuming
conversions or hard-to-find errors.

14
Fig: .Net Frameworks
Visual Studio.NET ships with languages such as Visual Basic. NET, Visual C#, and
Visual C++ with managed extensions, as well as the Jscript scripting language. You can
also write managed code for the .NET Framework in other languages. Third party tools
and compilers exist for FORTRAN, COBOL, Perl, and a host of other languages. All of
these languages share the same cross-language compatibility and inheritability. Thus, you
can write code for the .NET Framework in the language of your choice, and it will be
able to interact with code written for the .NET Framework in any other language.
WHAT IS VISUAL BASIC .NET?
Visual Basic .NET is the next version of Visual Basic. Rather than simply adding some
new features to Visual Basic 6.0, Microsoft has reengineered the product to make it easier
than ever before to write distributed applications such as Web and enterprise n-tier
systems. Visual Basic .NET has two new forms packages (Windows Forms and Web
Forms); a new version of ADO for accessing disconnected data sources; and streamlined
language, removing legacy keywords, improving type safety, and exposing low-level
constructs that advanced developers require. These new features open new doors for the
15
Visual Basic developer: With Web Forms and ADO .NET, you can now rapidly develop
scalable Web sites; with inheritance, the language now truly supports object- oriented
programming; Windows Forms natively supports accessibility and visual inheritance; and
deploying your applications is now as simple as copying your executables and
components from directory to directory. Visual Basic .NET is now fully integrated with
the other Microsoft Visual Studio .NET languages. Not only can you develop application
components in different programming languages, your classes can now inherit from
classes written in other languages using cross language inheritance. With the unified
debugger, you can now debug multiple language applications, irrespective of whether
they are running locally or on remote computers. Finally, whatever language you use, the
Microsoft .NET Framework provides a rich set of APIs for Microsoft Windows® and the
Internet.
UPGRADING TO VISUAL BASIC .NET
Visual Basic .NET enables a fundamental shift from traditional Windows development to
building next- generation Web and n-tier applications. For this reason, your code will
need to be upgraded to take advantage of Visual Basic .NET. This happens automatically
when you open a Visual Basic 6.0 project in Visual Basic .NET: the Upgrade Wizard
steps you through the upgrade process and creates a new Visual Basic .NET project (your
existing project is left unchanged). This is a one-way process; the new Visual Basic .NET
project cannot be opened in Visual Basic 6.0. When your project is upgraded, the
language is modified for any syntax changes and your Visual Basic 6.0 Forms are
converted to Windows Forms. In most cases, you will have to make some changes to
your code after it is upgraded. This is required because certain objects and language
features either have no equivalent in Visual Basic .NET, or have an equivalent too
dissimilar for an automatic upgrade. After the upgrade, you may also want to change your
application to take advantage of some of the new features in Visual Basic .NET.
ARCHITECTURE RECOMMENDATIONS
The .NET platform improves upon previous architectures, and adds greater support for
scalability and distributed applications though disconnected data access, HTTP-based
16
message transport, and file-copy based deployment (no more registering of components).
To best take advantage of these features, you should design your applications with
architecture similar to that you would use in Visual Basic .NET
THE STRUCTURE OF A .NET APPLICATION
To understand how the common language runtime manages code execution, you must
examine the structure of a .NET application. The primary unit of a .NET application is
the assembly. An assembly is a self-describing collection of code, resources, and
metadata. The assembly manifest contains information about what is contained within the
assembly. The assembly manifest provides,
• Identity information, such as the assembly’s name and version number.
• A list of all types exposed by the assembly.
• A list of other assemblies required by the assembly.
• A list of code access security instructions, including permissions required by the
assembly and permissions to be denied the assembly.
Each assembly has one and only one assembly manifest, and it contains all the
description information for the assembly. However, the assembly manifest can be
contained in its own file or within one of the assembly’s modules.
An assembly contains one or more modules. A module contains the code that makes up
your application or library, and it contains metadata that describes that code. When you
compile a project into an assembly, your code is converted from high-level code to IL.
Because all managed code is first converted to IL code, application written in different
languages can easily interact. For example one developer might write an application in
Visual C# that accesses a DLL in Visual Basic .NET. Both resources will be converted to
IL modules before being executed, thus avoiding any language-incompatibility issues.
Each module also contains a number of types. Types are templates that describe a set of
data encapsulation and functionality. There are two kinds of types: references types
(classes) and value types (structures). Each type is described to common language
runtime in the assembly manifest. A type can contain fields, properties, and methods,

17
each of which should be related to a common functionality. For example, you might have
a class that represents a bank account.
It contains fields, properties, and methods related to the functions needed to implement a
bank account. A field represents storage of a particular type of a data. One field might
store the name of an account holder, for example. Properties are similar to fields, but
properties usually provide some kind of validation when data is set or retrieved. You
might have a property that represents an account balance. When an attempt is made to
change the value, the property can check to see if the attempted change is greater than a
predetermined limit. If the value is greater than the limit, the property does not allow the
change. Methods represented behavior, such as actions taken on data stored within the
class or changes to the user interface. Continuing with the bank account example, you
might have a transfer method that transfers a balance from a checking account to a
savings account, or an alert method that warns users when their balances fall below a
predetermined level.
Compilation and Execution of a .Net Application
When you compile a .NET application, it is not compiled to binary machine code; rather,
it is converted to IL. This is the form that your deployed application takes-one or more
assemblies consisting of executable flies and DLL files in IL form. At least one of these
assemblies will contain an executable flies that has been designated as the entry point for
the application. When the execution of your programs begins, the first assembly is loaded
into memory.
At this point, the common language runtime examines the assembly manifest and
determines the requirements to run the program. It examines security permissions
requested by the assembly and compares them with the system’s security policy. If the
system’s security policy does not allow the requested permissions, the application will
not run. If the application passes the system’s security policy, the common language
runtime executes the code. It creates a process for the application to run in and begins
application execution. When execution starts, the first bit of the code from IL by the
common language runtime’s Just-In-Time (JIT) compiler. Once compiled, the code is
18
executed and stored in memory as native code. Thus, each portion of code is compiled
only once when an application executes. Whenever program execution branches to code
that has not yet run, the JIT compiler compiles it ahead of execution and stores it in
memory as binary code. This way, application performance is maximized because only
the part of a program is compiled.
The .NET Base Class Library
The .Net base class library is a collection of object-oriented types and interfaces that
provide object models and services for many of the complex programming tasks you will
face. Most of the types presented by the .NET base class library are fully extensible,
allowing you to build types that incorporate your own functionality into your managed
code. The .Net Framework base class library contains the base classes that provide many
of the services and objects you need when writing your applications. The class library is
organized into namespaces. A namespace is a logical grouping of types that perform
related functions. For example, the System.Windows.Forms namespace contains all the
types that make up Windows forms and the controls used in those forms.
The Namespaces are logical groupings of related classes. The namespaces in the .NET
base class library are organized hierarchically. The roots of the .NET Framework is the
system namespace construction appears as follows:
• System
• System. Data
• System.Data.SQLClient
INTRODUCTION TO ADO.NET
ADO.NET was designed to meet the needs of this new programming model,
• Disconnected data architecture,
• Tight integration with XML, common data representation with the ability to combine
data from multiple and varied data sources, and optimized facilities for interacting with a
database, all native to the .NET Framework.
DESIGN GOALS
• Leverage Current ADO Knowledge
19
• Support the N-Tier Programming
• Integrate XML Support
ADO.NET COMPONENTS
The ADO.NET components have been designed to factor data access from data
manipulation. There are two central components of ADO.NET that accomplish this: the
Data Set, and the .NET data provider, which is a set of components including the
Connection, Command, Data Reader, and Data Adapter objects.
The Data Set is explicitly designed for data access independent of any data source. As a
result it can be used with multiple and differing data sources, used with XML data, or
used to manage data local to the application.
The Data Set contains a collection of one or more Data Table objects made up of rows
and columns of data, as well as primary key, foreign key, constraint, and relation
information about the data in the Data Table objects.
The other core element of the ADO.NET architecture is the .NET data provider, whose
components is explicitly designed for data manipulation and fast, forward-only, readonly
access to data.
The Connection object provides connectivity to a data source.
The Command object enables access to database commands to return data, modify data,
run stored procedures, and send or retrieve parameter information.
The Data Reader provides a high-performance stream of data from the data source.
Finally, the Data Adapter provides the bridge between the Data Set object and the data
source. The Data Adapter uses Command objects to execute SQL commands at the data
source to both load the Data Set with data, and reconcile changes made to the data in the
Data Set back to the data source. You can write .NET data providers for any data source.
The .NET
Framework ships with two .NET data providers:
• SQL Server .NET Data Provider.
• OLEDB .NET Data Provider.
• ODBC .NET Data Provider.
20
Fig: Ado.Net Architecture
Advantages of .Net Framework
• Consistent programming model
• Multi-platform Applications
• Multi-language integration
• Automatic resource management
• Ease of deployment
5. TESTING AND IMPLEMENTATION

5.1 TESTING

Testing is a series of different tests that whose primary purpose is to fully


exercise the computer based system. Although each test has a different purpose, all work
should verify that all system element have been properly integrated and performed
allocated function. Testing is the process of checking whether the developed system
works according to the actual requirement and objectives of the system.

The philosophy behind testing is to find the errors. A good test is one that has a
high probability of finding an undiscovered error. A successful test is one that uncovers
the undiscovered error. Test cases are devised with this purpose in mind. A test case is a
21
set of data that the system will process as an input. However the data are created with the
intent of determining whether the system will process them correctly without any errors
to produce the required output.

Types of Testing:

 Unit testing
 Integration testing
 Validation testing
 Output testing
 User acceptance testing
Unit Testing

All modules were tested and individually as soon as they were completed and were
checked for their correct functionality.

Integration Testing

The entire project was split into small program; each of this single programs gives a
frame as an output. These programs were tested individually; at last all these programs
where combined together by creating another program where all these constructors were
used. It give a lot of problem by not functioning is an integrated manner.

The user interface testing is important since the user has to declare that the
arrangements made in frames are convenient and it is satisfied. when the frames where
given for the test, the end user gave suggestion. Based on their suggestions the frames
where modified and put into practice.

Validation Testing

At the culmination of the black box testing software is completely assembled as a


package. Interfacing errors have been uncovered and corrected and a final series of test
i.e., Validation succeeds when the software function in a manner that can be reasonably
22
Accepted by the customer.

Output Testing

After performing the validation testing the next step is output testing of the proposed
system. Since the system cannot be useful if it does not produce the required output.
Asking the user about the format in which the system is required tests the output
displayed or generated by the system under consideration. Here the output format is
considered in two ways. one is on screen and another one is printed format. The output
format on the screen is found to be corrected as the format was designed in the system
phase according to the user needs. And for the hardcopy the output comes according to
the specifications requested by the user.

User Acceptance System

An acceptance test as the objective of selling the user on validity and


reliability of the system. It verifies that the procedures operate to system specification and
mat the integrity of vital is maintained.

Performance Testing

This project is a application based project, and the modules are interdependent
with the other modules, so the testing cannot be done module by module. So the unit
testing is not possible in the case of this driver. So this system is checked only with their
performance to check their quality.

5.2 IMPLEMENTATION

System implementation is stage in the project where the theoretical design is


turned into the working system. The most crucial stage is giving the users confidence that
the new system will work effectively and efficiently.

23
The performance of reliability of the system is tested and it gained acceptance.
The system was implemented successfully. Implementation is a process that means
converting a new system in to operation.

Proper implementation is essential to provide a reliable system to meet


organization requirements. During the implementation stage a live demon was undertaken
and made in front of end-users. The various features provided in the system were
discussed during implementation

6. CONCLUSION

We uncovered another issue in remote sensor systems, alluded to as uninterrupted


ceaseless conterminous revelation. We contend that consistent conterminous revelation is
critical regardless of the fact that the sensor hubs are dynamic. In the event that the hubs
in an associated fragment cooperate on this errand, shrouded hubs are ensured to be
distinguished inside of a sure likelihood P and a sure duration T, with decreased
exhausted on the location. We demonstrated that our plan functions admirably if each hub
associated with a portion gauges the in-fragment level of its conceivable shrouded
neighbors. We then exhibited a constant neighbor revelation calculation that decides the
recurrence with which each hub recruits the text duration. We reenacted a detector system

24
to examine our calculations and demonstrated that when the concealed hubs are
consistently circulated in the zone.

7. FUTURE ENHANCEMENT
With the quick development of Internet of Things (IoT), one of its important supporting

technologies, i.e., wireless sensor networks (WSNs), gets much more attention. Neighbor

discovery is an indispensable procedure in WSNs. The existing deterministic neighbor

discovery algorithms in WSNs ensure that successful discovery can be obtained within a

given period of time, but the average discovery delay is long. It is difficult to meet the

need for rapid discovery in mobile low duty cycle environments. In addition, with the

rapid development of IoT, the node densities of many WSNs greatly increase. In such

scenarios, existing neighbor discovery methods fail to satisfy the requirement in terms of
25
discovery latency under the condition of the same energy consumption. This paper

proposes a group-based fast neighbor discovery algorithm (GBFA) to address the issues.

By carrying neighbor information in beacon packet, the node knows in advance some

potential neighbors. It selects more energy efficient potential neighbors and proactively

makes nodes wake up to verify whether these potential neighbors are true neighbors,

thereby speeding up neighbor discovery, improving energy utilization efficiency and

decreasing network communication load. The evaluation results indicate that, compared

with other methods, GBFA decreases the average discovery latency up to 10.58% at the

same energy budget.

8. APPENDIX

8.1 SOURCE CODE

Sender Code:

Imports System.Net.Sockets
Imports System.IO
Imports System.Text
Imports System.Data.OleDb
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.Net
Imports System.Runtime.Serialization.Formatters
Imports System.Threading

26
Public Class Form1
Dim a, b, c, d As String
Dim serverlistener As New TcpClient
Dim serverlistener1 As New TcpClient
Dim serverlistener2 As New TcpClient
Dim serverlistener3 As New TcpClient
Dim serverlistener4 As New TcpClient
Dim serverlistener5 As New TcpClient
Dim serverlistener6 As New TcpClient
Dim i As Integer
Private Sub btnbrowse_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnbrowse.Click
Dim o As New OpenFileDialog
o.ShowDialog()
a = o.FileName

Dim info As New FileInfo(a)


TextBox2.Text = info.Name
b = info.Length
End Sub
Private Sub button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles button2.Click
Dim s, s1 As String
Dim myTime As DateTime = DateTime.Now
d = myTime.Millisecond
s = InputBox("Enter Sink Node IP Address")
s1 = TextBox1.Text
serverlistener.Connect(s, 31534)
serverlistener1.Connect(s, 11000)
27
serverlistener2.Connect(s, 6000)
serverlistener3.Connect(s, 7000)
serverlistener4.Connect(s, 8000)
serverlistener5.Connect(s, 9000)
serverlistener6.Connect(s, 10000)
If serverlistener.Connected = True Then
serverlistener.SendBufferSize = 256
serverlistener1.SendBufferSize = 256
serverlistener2.SendBufferSize = 256
serverlistener3.SendBufferSize = 256
serverlistener4.SendBufferSize = 256
serverlistener5.SendBufferSize = 256
serverlistener6.SendBufferSize = 256
Dim str, str1, str2, str3, str4, str5, str6 As String
str = a
str1 = TextBox2.Text
str2 = b
str3 = ComboBox1.Text
str4 = s1
str5 = ComboBox2.Text
str6 = d
Dim sendBuff As Byte() = System.Text.Encoding.ASCII.GetBytes(str)
Dim sendBuff1 As Byte() = System.Text.Encoding.ASCII.GetBytes(str1)
Dim sendBuff2 As Byte() = System.Text.Encoding.ASCII.GetBytes(str2)
Dim sendBuff3 As Byte() = System.Text.Encoding.ASCII.GetBytes(str3)
Dim sendBuff4 As Byte() = System.Text.Encoding.ASCII.GetBytes(str4)
Dim sendBuff5 As Byte() = System.Text.Encoding.ASCII.GetBytes(str5)
Dim sendBuff6 As Byte() = System.Text.Encoding.ASCII.GetBytes(str6)
Dim readStream As Stream = serverlistener.GetStream
28
Dim readpwd As Stream = serverlistener1.GetStream
Dim readStream1 As Stream = serverlistener2.GetStream
Dim readpwd1 As Stream = serverlistener3.GetStream
Dim readpwd2 As Stream = serverlistener4.GetStream
Dim readpwd3 As Stream = serverlistener5.GetStream
Dim readpwd4 As Stream = serverlistener6.GetStream
readStream.Write(sendBuff, 0, sendBuff.Length)
readpwd.Write(sendBuff1, 0, sendBuff1.Length)
readStream1.Write(sendBuff2, 0, sendBuff2.Length)
readpwd1.Write(sendBuff3, 0, sendBuff3.Length)
readpwd2.Write(sendBuff4, 0, sendBuff4.Length)
readpwd3.Write(sendBuff5, 0, sendBuff5.Length)
readpwd4.Write(sendBuff6, 0, sendBuff6.Length)
Dim fs As FileStream = New FileStream(TextBox2.Text, FileMode.Open)
Dim buffer(fs.Length) As Byte
Dim len As Integer = fs.Length
fs.Read(buffer, 0, len)
fs.Close()
Dim br As BinaryFormatter = New BinaryFormatter
Dim myclient As TcpClient = New TcpClient(s, 5000)
Dim myns As NetworkStream = myclient.GetStream()
br.Serialize(myns, TextBox2.Text)
Dim mysw As BinaryWriter = New BinaryWriter(myns)
mysw.Write(buffer)
mysw.Close()
myns.Close()
myclient.Close()
End If
End Sub
29
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub
End Class

Sink Node Code:


Imports System.Net.Sockets
Imports System.IO
Imports System.Text
Imports System.Data.OleDb
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.Net
Imports System.Runtime.Serialization.Formatters
Imports System.Threading
Public Class Form1
Dim clientlisterner As New TcpListener(31534)
Dim clientlisterner1 As New TcpListener(11000)
Dim clientlisterner2 As New TcpListener(6000)
Dim clientlisterner3 As New TcpListener(7000)
Dim clientlisterner4 As New TcpListener(8000)
Dim clientlisterner5 As New TcpListener(9000)
Dim clientlisterner6 As New TcpListener(10000)
Dim serverlistener7 As New TcpClient
Dim cn As New OleDbConnection("Provider=microsoft.jet.oledb.4.0;Data source=" &
Application.StartupPath & "\layer.mdb;")
Dim com As OleDbCommand
Dim qry As String
Dim dr As OleDbDataReader
30
Dim a, a1, a2, a3, a4, a5, a6, d, d1 As String
Dim c As Integer
Dim myns1 As NetworkStream
Dim mytcpl As TcpListener
'Dim mysocket4 As Socket
Dim bb As BinaryReader
Dim op As Object
Dim k1, k2, k3 As String
Dim s, s1 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim myTime As DateTime = DateTime.Now
d = myTime.Millisecond
Try
a4 = ComboBox1.Text
Dim mysocket As Socket
Dim mysocket1 As Socket
Dim mysocket2 As Socket
Dim mysocket3 As Socket
Dim mysocket4 As Socket
Dim mysocket5 As Socket
Dim mysocket6 As Socket
clientlisterner.Start()
clientlisterner1.Start()
clientlisterner2.Start()
clientlisterner3.Start()
31
clientlisterner4.Start()
clientlisterner5.Start()
clientlisterner6.Start()
mysocket = clientlisterner.AcceptSocket()
mysocket1 = clientlisterner1.AcceptSocket()
mysocket2 = clientlisterner2.AcceptSocket()
mysocket3 = clientlisterner3.AcceptSocket()
mysocket4 = clientlisterner4.AcceptSocket()
mysocket5 = clientlisterner5.AcceptSocket()
mysocket6 = clientlisterner6.AcceptSocket()
Dim recieveBuff(225) As Byte
mysocket.Receive(recieveBuff, recieveBuff.Length, SocketFlags.None)
Dim str As String = System.Text.Encoding.ASCII.GetString(recieveBuff, 0,
recieveBuff.Length).Trim(Microsoft.VisualBasic.ChrW(0))
mysocket.Close()
clientlisterner.Stop()
Dim recieveBuff1(225) As Byte
mysocket1.Receive(recieveBuff1, recieveBuff1.Length, SocketFlags.None)
Dim str1 As String = System.Text.Encoding.ASCII.GetString(recieveBuff1, 0,
recieveBuff1.Length).Trim(Microsoft.VisualBasic.ChrW(0))

mysocket1.Close()
clientlisterner1.Stop()
Dim recieveBuff3(225) As Byte
mysocket3.Receive(recieveBuff3, recieveBuff3.Length, SocketFlags.None)
Dim str3 As String = System.Text.Encoding.ASCII.GetString(recieveBuff3, 0,
recieveBuff3.Length).Trim(Microsoft.VisualBasic.ChrW(0))
mysocket3.Close()
clientlisterner3.Stop()
32
Dim recieveBuff2(225) As Byte
mysocket2.Receive(recieveBuff2, recieveBuff2.Length, SocketFlags.None)
Dim str2 As String = System.Text.Encoding.ASCII.GetString(recieveBuff2, 0,
recieveBuff2.Length).Trim(Microsoft.VisualBasic.ChrW(0))
Dim recieveBuff4(225) As Byte
mysocket4.Receive(recieveBuff4, recieveBuff4.Length, SocketFlags.None)
Dim str4 As String = System.Text.Encoding.ASCII.GetString(recieveBuff4, 0,
recieveBuff4.Length).Trim(Microsoft.VisualBasic.ChrW(0))
mysocket4.Close()
clientlisterner4.Stop()
Dim recieveBuff5(225) As Byte
mysocket5.Receive(recieveBuff5, recieveBuff5.Length, SocketFlags.None)
Dim str5 As String = System.Text.Encoding.ASCII.GetString(recieveBuff5, 0,
recieveBuff5.Length).Trim(Microsoft.VisualBasic.ChrW(0))
mysocket5.Close()
clientlisterner5.Stop()

Dim recieveBuff6(225) As Byte


mysocket6.Receive(recieveBuff6, recieveBuff6.Length, SocketFlags.None)
Dim str6 As String = System.Text.Encoding.ASCII.GetString(recieveBuff6, 0,
recieveBuff6.Length).Trim(Microsoft.VisualBasic.ChrW(0))
mysocket6.Close()
clientlisterner6.Stop()
Dim portNumber As Integer = 5000
mytcpl = New TcpListener(IPAddress.Any, portNumber)
mytcpl.Start()
mysocket2 = mytcpl.AcceptSocket()
Thread.Sleep(2000)
myns1 = New NetworkStream(mysocket2)
33
Dim br As BinaryFormatter = New BinaryFormatter
op = br.Deserialize(myns1)
'Deserialize the Object from Stream
bb = New BinaryReader(myns1)
Dim buffer() As Byte = bb.ReadBytes(5000000)
Dim fss As FileStream = New FileStream(Application.StartupPath & "\" & op & "",
FileMode.CreateNew, FileAccess.Write)
fss.Write(buffer, 0, buffer.Length)
fss.Close()
mytcpl.Stop()
mysocket2.Close()
clientlisterner2.Stop()
d1 = Val(str6) - Val(d)
a = str
a1 = str1
a2 = str2
a3 = str3
a5 = str4
TextBox1.Text = a1
TextBox2.Text = a2
Timer1.Enabled = True
Catch ex As Exception
MessageBox.Show("File Already Exist ! ")
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
If a4 = "Node1" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
34
ps.Refresh()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wRed.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Dim serverlistener6 As New TcpClient
Dim serverlistener3 As New TcpClient
s = a5
serverlistener6.Connect(s, 31536)
serverlistener3.Connect(s, 7005)
serverlistener6.SendBufferSize = 256
serverlistener3.SendBufferSize = 256
Dim str11, str3 As String
str11 = ComboBox1.Text
str3 = "Node"

Dim sendBuff6 As Byte() = System.Text.Encoding.ASCII.GetBytes(str11)


Dim sendpwd3 As Byte() = System.Text.Encoding.ASCII.GetBytes(str3)
Dim readStream6 As Stream = serverlistener6.GetStream
Dim readpwd3 As Stream = serverlistener3.GetStream
readStream6.Write(sendBuff6, 0, sendBuff6.Length)
readpwd3.Write(sendpwd3, 0, sendpwd3.Length)
serverlistener6.Close()
serverlistener3.Close()
Label11.Text = "Collision Occured Packet Transmitting work is Stoped"
Timer1.Enabled = False
Timer2.Enabled = False
ElseIf a4 = "Node2" Then
35
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wRed.jpg")
p2.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Dim serverlistener6 As New TcpClient
Dim serverlistener3 As New TcpClient
s = a5

serverlistener6.Connect(s, 31536)
serverlistener3.Connect(s, 7005)
serverlistener6.SendBufferSize = 256
serverlistener3.SendBufferSize = 256
Dim str11, str3 As String
str11 = ComboBox1.Text
str3 = "Node"
Dim sendBuff6 As Byte() = System.Text.Encoding.ASCII.GetBytes(str11)
Dim sendpwd3 As Byte() = System.Text.Encoding.ASCII.GetBytes(str3)
Dim readStream6 As Stream = serverlistener6.GetStream
Dim readpwd3 As Stream = serverlistener3.GetStream
readStream6.Write(sendBuff6, 0, sendBuff6.Length)
readpwd3.Write(sendpwd3, 0, sendpwd3.Length)
36
serverlistener6.Close()
serverlistener3.Close()
Label11.Text = "Collision Occured Packet Transmitting work is Stoped"
Timer1.Enabled = False
Timer2.Enabled = False
ElseIf a4 = "Node3" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")

p2.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p3.Load("D:\mac layer\SinkNode\SinkNode\images\wRed.jpg")
p3.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Dim serverlistener6 As New TcpClient
Dim serverlistener3 As New TcpClient
s = a5
serverlistener6.Connect(s, 31536)
serverlistener3.Connect(s, 7005)
serverlistener6.SendBufferSize = 256
37
serverlistener3.SendBufferSize = 256
Dim str11, str3 As String
str11 = ComboBox1.Text
str3 = "Node"
Dim sendBuff6 As Byte() = System.Text.Encoding.ASCII.GetBytes(str11)
Dim sendpwd3 As Byte() = System.Text.Encoding.ASCII.GetBytes(str3)
Dim readStream6 As Stream = serverlistener6.GetStream
Dim readpwd3 As Stream = serverlistener3.GetStream
readStream6.Write(sendBuff6, 0, sendBuff6.Length)
readpwd3.Write(sendpwd3, 0, sendpwd3.Length)
serverlistener6.Close()
serverlistener3.Close()
Label11.Text = "Collision Occured Packet Transmitting work is Stoped"
Timer1.Enabled = False
Timer2.Enabled = False
ElseIf a4 = "Node4" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p2.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p3.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
38
p3.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p4.Load("D:\mac layer\SinkNode\SinkNode\images\wRed.jpg")
p4.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Dim serverlistener6 As New TcpClient
Dim serverlistener3 As New TcpClient
s = a5
serverlistener6.Connect(s, 31536)
serverlistener3.Connect(s, 7005)
serverlistener6.SendBufferSize = 256
serverlistener3.SendBufferSize = 256

Dim str11, str3 As String


str11 = ComboBox1.Text
str3 = "Node"
Dim sendBuff6 As Byte() = System.Text.Encoding.ASCII.GetBytes(str11)
Dim sendpwd3 As Byte() = System.Text.Encoding.ASCII.GetBytes(str3)
Dim readStream6 As Stream = serverlistener6.GetStream
Dim readpwd3 As Stream = serverlistener3.GetStream
readStream6.Write(sendBuff6, 0, sendBuff6.Length)
readpwd3.Write(sendpwd3, 0, sendpwd3.Length)
serverlistener6.Close()
serverlistener3.Close()
Timer1.Enabled = False
Timer2.Enabled = False
Label11.Text = "Collision Occured Packet Transmitting work is Stoped"
39
Else
If a3 = "Node1" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Label11.Text = "Packet Received Success"
ElseIf a3 = "Node2" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)

p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p2.Refresh()
' Application.DoEvents()
Thread.Sleep(1500)
Label11.Text = "Packet Received Success"
ElseIf a3 = "Node3" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
40
'Application.DoEvents()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p2.Refresh()
' Application.DoEvents()
Thread.Sleep(1500)
p3.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p3.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)

Label11.Text = "Packet Received Success"


ElseIf a3 = "Node4" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p2.Refresh()
' Application.DoEvents()
41
Thread.Sleep(1500)
p3.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p3.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p4.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p4.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Label11.Text = "Packet Received Success"
ElseIf a3 = "Node5" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)

p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p2.Refresh()
' Application.DoEvents()
Thread.Sleep(1500)
p3.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p3.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p4.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
42
p4.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p5.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p5.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Label11.Text = "Packet Received Success"
ElseIf a3 = "Node5" Then
ps.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
ps.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p1.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p1.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p2.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p2.Refresh()
' Application.DoEvents()
Thread.Sleep(1500)
p3.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p3.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p4.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p4.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
43
p5.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p5.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
p6.Load("D:\mac layer\SinkNode\SinkNode\images\wgreen.jpg")
p6.Refresh()
'Application.DoEvents()
Thread.Sleep(1500)
Label11.Text = "Packet Received Success"
End If
Timer1.Enabled = False
Timer2.Enabled = True
End If

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer2.Tick
Dim serverlistener6 As New TcpClient
Dim serverlistener3 As New TcpClient
s = a5
serverlistener6.Connect(s, 31536)
serverlistener3.Connect(s, 7005)
serverlistener6.SendBufferSize = 256
serverlistener3.SendBufferSize = 256
Dim str12, str13, str14 As String
str12 = a
str13 = a1
Dim sendBuff6 As Byte() = System.Text.Encoding.ASCII.GetBytes(str12)
44
Dim sendpwd3 As Byte() = System.Text.Encoding.ASCII.GetBytes(str13)
Dim readStream6 As Stream = serverlistener6.GetStream
Dim readpwd3 As Stream = serverlistener3.GetStream
readStream6.Write(sendBuff6, 0, sendBuff6.Length)
readpwd3.Write(sendpwd3, 0, sendpwd3.Length)
serverlistener6.Close()
serverlistener3.Close()
Dim fil As String = Application.StartupPath & "\" & op & ""
Dim fs As FileStream = New FileStream(fil, FileMode.Open)
Dim buffer1(fs.Length) As Byte
Dim len As Integer = fs.Length
fs.Read(buffer1, 0, len)
fs.Close()
Dim br1 As BinaryFormatter = New BinaryFormatter

Dim myclient2 As TcpClient = New TcpClient(s, 5001)


Dim myns2 As NetworkStream = myclient2.GetStream()
br1.Serialize(myns2, str13)
Dim msw As BinaryWriter = New BinaryWriter(myns2)
mysw.Write(buffer1)
mysw.Close()
myns2.Close()
myclient2.Close()
Timer2.Enabled = False
End Sub
End Class
Receiver Code:
Imports System.Net.Sockets
45
Imports System.IO
Imports System.Text
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.Net
Imports System.Runtime.Serialization.Formatters
Imports System.Threading
Public Class Form1
'Dim clientlisterner As New TcpListener(31536)
'Dim clientlisterner1 As New TcpListener(6005)
''Dim clientlisterner2 As New TcpListener(6006)
Dim clientlisterner3 As New TcpListener(7005)
Dim clientlisterner6 As New TcpListener(31536)
Dim mysocket As Socket
Dim mysocket1 As Socket
Dim mysocket2 As Socket
Dim mysocket3 As Socket
Dim myns1 As NetworkStream
Dim mytcpl As TcpListener
Dim mysocket5, mysocket6 As Socket
Dim bb As BinaryReader
Dim op As Object
Dim file1 As String
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Try
clientlisterner3.Start()
clientlisterner6.Start()
mysocket3 = clientlisterner3.AcceptSocket()
mysocket6 = clientlisterner6.AcceptSocket()
46
Dim recieveBuff3(225) As Byte
Dim recieveBuff6(225) As Byte
mysocket6.Receive(recieveBuff6, recieveBuff6.Length, SocketFlags.None)
Dim str6 As String = System.Text.Encoding.ASCII.GetString(recieveBuff6, 0,
recieveBuff6.Length).Trim(Microsoft.VisualBasic.ChrW(0))
mysocket3.Receive(recieveBuff3, recieveBuff3.Length, SocketFlags.None)
Dim str3 As String = System.Text.Encoding.ASCII.GetString(recieveBuff3, 0,
recieveBuff3.Length).Trim(Microsoft.VisualBasic.ChrW(0))
'MsgBox(str3)
If str3 = "Node" Then
Label3.Text = "Collision Occured Packet Transmitting work is Stoped"
Label5.Text = str6
Else
'MsgBox("hai")

Dim portNumber As Integer = 5001


mytcpl = New TcpListener(IPAddress.Any, portNumber)
mytcpl.Start()
mysocket5 = mytcpl.AcceptSocket()
Thread.Sleep(2000)
myns1 = New NetworkStream(mysocket5)
Dim br As BinaryFormatter = New BinaryFormatter
op = br.Deserialize(myns1)
'Deserialize the Object from Stream
bb = New BinaryReader(myns1)
Dim buffer() As Byte = bb.ReadBytes(5000000)
Dim fss As FileStream = New FileStream(Application.StartupPath & "\" & op & "",
FileMode.CreateNew, FileAccess.Write)
47
fss.Write(buffer, 0, buffer.Length)
fss.Close()
mytcpl.Stop()
myns1.Close()
file1 = Application.StartupPath & "\" & op & ""
TextBox1.Text += System.IO.File.ReadAllText(file1)
Label3.Text = "File Receive Success"
End If
Catch ex As Exception
MessageBox.Show("File Not Received ! ")
End Try
End Sub
End Class

8.2. SCREEN SHOTS

48
Sender:

Router:

49
Reciever:

50
51
9. BIBLIOGRAPHY
[1]Reuven Cohen and Boris Kapchits, Continuous Neighbor Discovery in Asynchronous
Sensor Networks IEEE/ACM transactions on networking, vol. 19, no. 1, feb 2011.
[2] S. Vasudevan, J. Kurose, and D. Towsley, On neighbor discovery in wireless networks
with directional antennas,. in INFOCOM, vol. 4, 2005, pp. 2502.2512.
[3] R. Madan and S. Lall, .An energy-optimal algorithm for neighbor discovery in
wireless sensor networks,. Mob. Netw. Appl., vol. 11, no. 3, pp. 317.326, 2006.
[4] M. J. McGlynn and S. A. Borbash, .Birthday protocols for low energy deployment
and flexible neighbor discovery in ad hoc wirelessnetworks,. in MobiHoc: Proceedings of
the 2nd ACM International Symposium on Mobile Ad Hoc Networking and Computing.
New York, NY,USA: ACM Press, 2001, pp. 137.145.
[5] D. Baker and A. Ephremides, .The architectural organization of a mobile radio
network via a distributed algorithm,. in IEEE Transactions on Communications, vol. 29,
Nov. 1981, pp. 694.1701.
[6] A. Keshavarzian and E. Uysal-Biyikoglu, .Energyeffcient link assessment in wireless
sensor networks,. in INFOCOM, 2004.
[7] G. Alonso, E. Kranakis, R. Wattenhofer, and P. Widmayer, .Probabilistic protocols for
node discovery in ad-hoc, single broadcast channel networks,. in IPDPS, 2003, p. 218. [8]
E. B. Hamida, G. Chelius, and E. Fleury, .Revisiting neighbor discovery with
interferences consideration,. in PE-WASUN, 2006, pp. 74.81.
[9] S. A. Borbash, .Design considerations in wireless sensor networks,. Ph.D. dissertation,
ISR, August 2004.
[10] Infrastructure-based routing in wireless mobile adhoc networks Computer
Communications Volume 25, Issue 3, 15 February 2002, Pages 210-224 Ahmed Safwat,
Hossam Hassanein

52

You might also like