You are on page 1of 111

AN OPTIMIZATION FRAMEWORK FOR MOBILE DATA

COLLECTION IN ENERGY-HARVESTING WIRELESS SENSOR

ABSTRACT

Recent advances in environmental energy harvesting tech-nologies have


provided great potentials for traditional battery-powered sensor networks to
achieve perpetual operations. Due to dynamics from the temporal profiles of
ambient energy sources, most of the studies so far have focused on designing
and optimizing energy management schemes on single sensor node, but
overlooked the impact of spatial variations of energy distribution when sensors
work together at different locations. To design a robust sensor network, in this
paper, we use mobility to circumvent communication bottlenecks caused by
spatial energy variations. We employ a mobile collector, called SenCar to
collect data from designated sensors and balance energy consumptions in the
network. To show spatial-temporal energy variations, we first conduct a case
study in a solar-powered network and analyze possible impact on network
performance. Next, we present a two-step approach for mobile data collection.
First, we adaptively select a subset of sensor locations where the SenCar stops
to collect data packets in a multi-hop fashion. We develop an adaptive
algorithm to search for nodes based on their energy and guarantee data
collection tour length is bounded. Second, we focus on designing distributed
algorithms to achieve maximum network utility by adjusting data rates, link
scheduling and flow routing that adapts to the spatial-temporal environmental
energy fluctuations. Finally, our numerical results indicate the distributed
algorithms can converge to optimality very fast and validate its convergence in
case of node failure.
CHAPTER 1

INTRODUCTION

What is Mobile Computing?

Mobile computing is the discipline for creating an information management


platform, which is free from spatial and temporal constraints. The freedom from
these constraints allows its users to access and process desired information from
anywhere in the space. The state of the user, static or mobile, does not affect the
information management capability of the mobile platform. A user can continue
to access and manipulate desired data while traveling on plane, in car, on ship,
etc. Thus, the discipline creates an illusion that the desired data and sufficient
processing power are available on the spot, where as in reality they may be
located far away. Otherwise Mobile computing is a generic term used to refer
to a variety of devices that allow people to access data and information from
where ever they are.

Structure of mobile computing


1.1.1 Different types of devices used for the mobile computing:

Personal digital assistant/enterprise digital assistant

Smartphones

Tablet computers

Netbooks

Ultra-mobile PCs

Wearable computers

Palmtops/pocket computers

1.1.2 Applications of Mobile Computing:

Vehicles:
Tomorrows cars will comprise many wireless communication
systems and mobility aware applications. Music, news, road conditions,
weather reports, and other broadcast information are received via digital audio
broadcasting (DAB) with 1.5 M-bits/s. For personal communication, a global
system for mobile communications (GSM) phone might be available offering
voice and data connectivity with 384 k-bits/s. For remote areas satellite
communication can be used, while the current position of the car is determined
via global positioning system (GPS). Additionally, cars driving in the same
area build a local ad-hoc network for fast information exchange in emergency
situations or to help each other keeping a safe distance. In case of an accident,
not only will the airbag be triggered, but also an emergency call to a service
provider informing ambulance and police. Cars with this technology are
already available. Future cars will also inform other cars about accidents via the
ad hoc network to help them slow down in time, even before a driver can
recognize the accident. Buses, trucks, and train are already transmitting
maintenance and logistic information to their home base, which helps o improve
organization (fleet management), and thus save time and money.

Emergency:
Just imagine the possibilities of an ambulance with a high quality
wireless connection to a hospital. After an accident, vital information about
injured persons can be sent to the hospital immediately. There, all necessary
steps for this particular type of accident can be prepared or further specialists
can be consulted for an early diagnosis. Furthermore, wireless networks
are the only means of communication in the case of natural disasters such as
hurricanes or earthquakes.

Business:
Todays typical traveling salesman needs instant access to the
companys database: to ensure that the files on his or her laptop reflect the
actual state, to enable the company to keep track of all activities of their
traveling employees, to keep databases consistent etc., with wireless access, the
laptop can be turned into a true mobile office.

1.1.3 Benefits of Mobile Computing:

Improve business productivity by streamlining interaction and taking


advantage of immediate access

Reduce business operations costs by increasing supply chain visibility,


optimizing logistics and accelerating processes

Strengthen customer relationships by creating more opportunities to


connect, providing information at their fingertips when they need it most
Gain competitive advantage by creating brand differentiation and
expanding customer experience

Increase work force effectiveness and capability by providing on-the-go


access

Improve business cycle processes by redesigning work flow to utilize


mobile devices that interface with legacy applications

Advantages of Mobile Computing:

Mobile computing has changed the complete landscape of human being life.
Following are the clear advantages of Mobile Computing:

Location flexibility:

This has enabled user to work from anywhere as long as there is a connection
established. A user can work without being in a fixed position. Their mobility
ensures that they are able to carry out numerous tasks at the same time perform
their stated jobs.

Saves Time:

The time consumed or wasted by travelling from different locations or to the


office and back, have been slashed. One can now access all the important
documents and files over a secure channel or portal and work as if they were on
their computer. It has enhanced telecommuting in many companies. This also
reduces unnecessary expenses that might be incurred.

Enhanced Productivity:
Productive nature has been boosted by the fact that a worker can simply work
efficiently and effectively from which ever location they see comfortable and
suitable. Users are able to work with comfortable environments.

Ease of research:

Research has been made easier, since users will go to the field and search for
facts and feed them back to the system. It has also made it easier for field
officer and researchers to collect and feed data from wherever they without
making unnecessary trip to and from the office to the field.

Entertainment:

Video and audio recordings can now be streamed on the go using mobile
computing. It's easy to access a wide variety of movies, educational and
informative material. With the improvement and availability of high speed data
connections at considerable costs, one is able to get all the entertainment they
want as they browser the internet for streamed data. One can be able to watch
news, movies, and documentaries among other entertainment offers over the
internet. This was not such before mobile computing dawned on the computing
world.

Streamlining of Business Processes:

Business processes are now easily available through secured connections.


Basing on the factor of security, adequate measures have been put in place to
ensure authentication and authorization of the user accessing those services.

Some business functions can be run over secure links and also the sharing of
information between business partners. Also it's worth noting that lengthy
travelling has been reduced, since there is the use of voice and video
conferencing.
Meetings, seminars and other informative services can be conducted using the
video and voice conferencing. This cuts down on travel time and expenditure

1.2 OBJECTIVE OF THE PROJECT

With billions in downloads and annual revenue, smartphone applications


offered by Apple iTunes and Android are quickly becoming the dominant
computing platform for todays user applications.
Within these markets, a new wave of geo-social applications are fully
exploiting GPS location services to provide a social interface to the
physical world.
The explosive popularity of mobile social networks such as SCVNGR
and FourSquare (3 million new users in 1 year) likely indicate that in the
future, social recommendations will be our primary source of information
about our surroundings Unfortunately, this new functionality comes with
signifi- cantly increased risks topersonal privacy.
Geo-social applications operate on fine-grain, time-stamped location
information.
CHAPTER 2

SYSTEM ANALYSIS

In this phase a detailed appraisal of the existing system is explained. This


appraisal includes how the system works and what it does. It also includes
finding out in more detail- what are the problems with the system and what user
requires from the new system or any new change in system. The output of this
phase results in the detail model of the system. The model describes the system
functions and data and system information flow. The phase also contains the
detail set of user requirements and these requirements are used to set objectives
for the new system.

2.1 CURRENT SYSTEM:

Environmental energy harvesting has emerged as a promising technique to


provide sustainable energy sources for battery-powered wireless sensor
networks (WSNs), whose network longevity is constrained by battery capacity.
Renewable energy sources such as solar, wind, thermal necessitates Cyber
Physical Systems (a network consists of sensors and actuators to interact with
the physical world) for achieving energy efficiency and cost effectiveness. For
example, solar harvesting is proven to be useful to provide energy to sensors
from a solar panel of relatively similar size of sensors.

2.2 SHORTCOMINGS OF THE CURRENT SYSTEM:

The introduction of mobility not only alleviates routing burdens on the


congested nodes to save energy , but also shows flexibility to circumvent
congested area that lacks of energy supply.
We can easily direct the SenCar to collect packets from designated
regions to avoid draining sensors battery where the environmental
energy supply is not sufficient at that time.
2.3 PROPOSED SYSTEM:

We propose a two-step approach. In the first step, we determine where the


SenCar stops to collect data packets while guaranteeing that the total migration
tour length is bounded by a threshold. These node positions are called anchors.
In the second step, after the anchors have been selected, we formulate the
optimization problem into a network utility maximization problem under the
constraints of flow, energy balance, battery and link capacity. In particular, in
our formulation, energy conservation captures the time-varying and spatial
variations of energy harvesting rates.

2.4 ADVANTAGE OF PROPOSED SYSTEM:

First, we propose a new framework by introducing mobile data collection


for energy harvesting sensor networks.
Second, we develop an adaptive anchor selection algorithm for the
SenCar to achieve a balance between data collection amount and latency.
Third, given the selected anchors, we propose distributed algorithms to
find optimal data rates, link flows for sensors and sojourn time allocation
for the SenCar.
Finally, we provide extensive evaluations to demonstrate that the
proposed scheme can converge to optimum, react to the dynamics of
energy income effectively, maintain perpetual network operation and
improve network utility significantly compared to the network with a
static data sink.
IMPLEMENTATION

Implementation is the stage of the project when the theoretical design is turned
out into a working system. Thus it can be considered to be the most critical stage in
achieving a successful new system and in giving the user, confidence that the new
system will work and be effective.

The implementation stage involves careful planning, investigation of the


existing system and its constraints on implementation, designing of methods to
achieve changeover and evaluation of changeover methods.

MODULES:
A module is a part of a program. Programs are composed of one or more
independently developed modules that are not combined until the program is linked. A
single module can contain one or several routines.

Our project modules are given below:

Sender Selection Module

Channel assessment Module

Segmentation Module

Impact Estimation Module

SENDER SELECTION MODULE:


In this module, we select the best sender for forwarding the data while avoiding
simultaneous transmissions from other neighboring nodes. This involves two main
aspects. First, an accurate metric should be devised to estimate senders impacts.
Second, efficient mechanisms should be designed to coordinate transmissions of
eligible senders so that the largest impact sender is most likely to transmit.

CHANNEL ASSESSMENT MODULE:


In this module, the MAC layer performs clear channel assessment (CCA) to
check
whether the channel is busy. If the channel is clear, the data packet is transmitted
immediately. If the channel is busy, the MAC layer performs a congestion backoff.

SEGMENTATION MODULE:

In this module, a node receives the pages in the sequential order. When a node
receives a page, it advertises about its available pages. When a node learns that
another node has more available pages, it requests for the page and the page
transmission starts. In this way, ECD does not require a node to have an entire code
image to serve other nodes. Instead, whenever a node has more available pages, it can
serve other nodes having fewer available pages. So as long as the transmissions at two
links do not collide, different pages can be transmitted concurrently at these two links.

IMPACT ESTIMATION MODULE:

In this module, we estimate the number of uncovered nodes and the outbound
link qualities to them. In order to estimate the number of uncovered nodes, we use the
REQ messages sent by uncovered nodes when missing packets are detected. in ECD,
the uncovered nodes send REQ messages unless there is an ongoing page
transmission. The
estimation period for sending and receiving REQ messages is carefully selected to
avoid REQ collisions.
CHAPTER 4

LITERATURE SURVEY

4.1 OVERVIEW:

A literature review is an account of what has been published on a topic by


accredited scholars and researchers. Occasionally you will be asked to write one
as a separate assignment, but more often it is part of the introduction to an
essay, research report, or thesis. In writing the literature review, your purpose is
to convey to your reader what knowledge and ideas have been established on a
topic, and what their strengths and weaknesses are. As a piece of writing, the
literature review must be defined by a guiding concept (e.g., your research
objective, the problem or issue you are discussing or your argumentative thesis).
It is not just a descriptive list of the material available, or a set of summaries

Besides enlarging your knowledge about the topic, writing a literature


review lets you gain and demonstrate skills in two areas

1. INFORMATION SEEKING: the ability to scan the literature


efficiently, using manual or computerized methods, to identify a set of
useful articles and books

2. CRITICAL APPRAISAL: the ability to apply principles of analysis to


identify unbiased and valid studies.

4.2 A BATTERY-AWARE SCHEME FOR ROUTING IN WIRELESS


AD HOC NETWORKS

Wireless ad hoc networks have played an increasingly important role in a wide range of
applications. A key challenge in such networks is to achieve maximum lifetime for battery-
powered mobile devices with dynamic energy-efficient algorithms. Recent studies in battery
technology have revealed that the behaviour of battery discharging is more complex than we
used to know. Battery-powered devices might waste a huge amount of energy if their
battery discharging is not carefully scheduled and budgeted. In this paper, we introduce a
novel energy model for batteries and study the effect of battery behaviour on routing in
wireless ad hoc networks. We first propose an online computable discrete-time
mathematical model to capture battery discharging behaviour. The model has low
computational complexity and data storage requirement. It is therefore suitable for online
battery capacity computation in routing. Our evaluations indicate that the model can
accurately capture the behaviour of battery discharging. Based on this battery model, we
then propose a battery-aware routing (BAR) scheme for wireless ad hoc networks. BAR is a
generic scheme that implements battery awareness in routing protocols and is independent
of any specific routing protocol. By dynamically choosing the devices with well-recovered
batteries as routers and leaving the fatigue batteries for recovery, the BAR scheme can
effectively recover the device's battery capacity to achieve higher energy efficiency. Our
simulation results demonstrate that, by adopting the BAR scheme, network lifetime and data
throughput can be increased by up to 28% and 24%, respectively. The results also show that
BAR achieves good performance in various networks composed of different devices,
batteries, and node densities. Finally, we also propose an enhanced prioritized BAR (PBAR)
scheme for time-sensitive applications in wireless ad hoc networks. Our simulation results
illustrate that PBAR achieves good performance in terms of end-to-end delay and data
throughput.

4.3 TOUR PLANNING FOR MOBILE DATA-GATHERING


MECHANISMS IN WIRELESS SENSOR NETWORKS

In this paper, we propose a new data-gathering mechanism for large-scale wireless sensor
networks by introducing mobility into the network. A mobile data collector, for
convenience called an M-collector in this paper, could be a mobile robot or a vehicle
equipped with a powerful transceiver and battery, working like a mobile base station and
gathering data while moving through the field. An M-collector starts the data-gathering tour
periodically from the static data sink, polls each sensor while traversing its transmission
range, then directly collects data from the sensor in single-hop communications, and finally
transports the data to the static sink. Since data packets are directly gathered without relays
and collisions, the lifetime of sensors is expected to be prolonged. In this paper, we mainly
focus on the problem of minimizing the length of each data-gathering tour and refer to this
as the single-hop data-gathering problem (SHDGP). We first formalize the SHDGP into a
mixed-integer program and then present a heuristic tour-planning algorithm for the case
where a single M-collector is employed. For the applications with strict distance/time
constraints, we consider utilizing multiple M-collectors and propose a data-gathering
algorithm where multiple M-collectors traverse through several shorter subtours
concurrently to satisfy the distance/time constraints. Our single-hop mobile data-gathering
scheme can improve the scalability and balance the energy consumption among sensors. It
can be used in both connected and disconnected networks. Simulation results demonstrate
that the proposed data-gathering algorithm can greatly shorten the moving distance of the
collectors compared with the covering line approximation algorithm and is close to the
optimal algorithm for small networks. In addition, the proposed data-gathering scheme can
significantly prolong the network lifetime compared with a network with static data sink or
a network in which the mobile collector can only move along straight lines.

4.4 OPTIMIZATION-BASED DISTRIBUTED ALGORITHMS FOR


MOBILE DATA GATHERING IN WIRELESS SENSOR NETWORKS

Recent advances have shown a great potential of mobile data gathering in wireless sensor
networks, where one or more mobile collectors are employed to collect data from sensors
via short-range communications. Among a variety of data gathering approaches, one typical
scheme is called anchor-based mobile data gathering. In such a scheme, during each
periodic data gathering tour, the mobile collector stays at each anchor point for a period of
sojourn time, and in the meanwhile the nearby sensors transmit data to the collector in a
multihop fashion. In this paper, we focus on such a data gathering scheme and provide
distributed algorithms to achieve its optimal performance. We consider two different cases
depending on whether the mobile collector has fixed or variable sojourn time at each anchor
point. We adopt network utility, which is a properly defined function, to characterize the
data gathering performance, and formalize the problems as network utility maximization
problems under the constraints of guaranteed network lifetime and data gathering latency.
To efficiently solve these problems, we decompose each of them into several subproblems
and solve them in a distributed manner, which facilitates the scalable implementation of the
optimization algorithms. Finally, we provide extensive numerical results to demonstrate the
usage and efficiency of the proposed algorithms and complement our theoretical analysis.
4.5 BOUNDED RELAY HOP MOBILE DATA GATHERING IN
WIRELESS SENSOR NETWORKS

Recent study reveals that great benefit can be achieved for data gathering in wireless sensor
networks by employing mobile collectors that gather data via short-range communications.
To pursue maximum energy saving at sensor nodes, intuitively, a mobile collector should
traverse the transmission range of each sensor in the field such that each data packet can be
directly transmitted to the mobile collector without any relay. However, this approach may
lead to significantly increased data gathering latency due to the low moving velocity of the
mobile collector. Fortunately, it is observed that data gathering latency can be effectively
shortened by performing proper local aggregation via multihop transmissions and then
uploading the aggregated data to the mobile collector. In such a scheme, the number of local
transmission hops should not be arbitrarily large as it may increase the energy consumption
on packet relays, which would adversely affect the overall efficiency of mobile data
gathering. Based on these observations, in this paper, we study the trade off between energy
saving and data gathering latency in mobile data gathering by exploring a balance between
the relay hop count of local data aggregation and the moving tour length of the mobile
collector. We first propose a polling-based mobile gathering approach and formulate it into
an optimization problem, named bounded relay hop mobile data gathering (BRH-MDG).
Specifically, a subset of sensors will be selected as polling points that buffer locally
aggregated data and upload the data to the mobile collector when it arrives. In the
meanwhile, when sensors are affiliated with these polling points, it is guaranteed that any
packet relay is bounded within a given number of hops. We then give two efficient
algorithms for selecting polling points among sensors. The effectiveness of our approach is
validated through extensive simulations.

4.6 A COST MINIMIZATION ALGORITHM FOR MOBILE DATA


GATHERING IN WIRELESS SENSOR NETWORKS

Recent studies have shown that significant benefit can be achieved in wireless sensor
networks (WSNs) by employing mobile collectors for data gathering via short-range
communications. A typical scenario for such a scheme is that a mobile collector roams over
the sensing field and pauses at some anchor points on its moving tour such that it can
traverse the transmission range of all the sensors in the field and directly collect data from
each sensor. In this paper, we study the performance optimization of such mobile data
gathering by formulating it into a cost minimization problem constrained by the channel
capacity, the minimum amount of data gathered from each sensor and the bound of total
sojourn time at all anchor points. We assume that the cost of a sensor for a particular anchor
point is a function of the data amount a sensor uploads to the mobile collector during its
sojourn time at this anchor point. In order to provide an efficient and distributed algorithm,
we decompose this global optimization problem into two sub problems to be solved by each
sensor and the mobile collector, respectively. We show that such decomposition can be
characterized as a pricing mechanism, in which each sensor independently adjusts its
payment for the data uploading opportunity to the mobile collector based on the shadow
prices of different anchor points. Correspondingly, we give an efficient algorithm to jointly
solve the two sub problems. Our theoretical analysis demonstrates that the proposed
algorithm can achieve the optimal data control for each sensor and the optimal sojourn time
allocation for the mobile collector, which minimizes the overall network cost. Finally,
extensive simulation results further validate that our algorithm achieves lower cost than the
compared data gathering strategy.
CHAPTER 5

5.1 METHODOLOGY

DISTRIBUTED ALGORITHM :

A distributed algorithm is an algorithm designed to run on computer


hardware constructed from interconnected processors. Distributed algorithms
are used in many varied application areas of distributed computing, such
as telecommunications, scientific computing, distributed information
processing, and real-time process control. Standard problems solved by
distributed algorithms include leader election, consensus,
distributed search, spanning tree generation, mutual exclusion, and resource
allocation.

ADAPTIVE ALGORITHM

An adaptive algorithm is an algorithm that changes its behavior based on


information available at the time it is run. This might be information about
computational resources available, or the history of data recently received.
CHAPTER 6

SYSTEM SPECIFICATION

The purpose of system requirement specification is to produce the


specification analysis of the task and also to establish complete information
about the requirement, behavior and other constraints such as functional
performance and so on. The goal of system requirement specification is to
completely specify the technical requirements for the product in a concise and
unambiguous manner.

6.1 HARDWARE REQUIREMENTS

System : Pentium IV 2.4 GHz.


Hard Disk : 40 GB.
Floppy Drive : 1.44 Mb.
Monitor : 15 VGA Colour.
Mouse : Logitech.
Ram : 512 Mb.

6.2 SOFTWARE REQUIREMENTS

Operating system : Windows XP/7.


Coding Language : ASP.net, C#.net
Tool : Visual Studio 2010
Database : SQL SERVER 2008
CHAPTER 7

SOFTWARE ENVIRONMENT

.NET Framework
The Microsoft .NET Framework (pronounced dot net) is a software
framework developed by Microsoft that runs primarily on Microsoft Windows. It
includes a large class library known as Framework Class Library (FCL) and
provides language interoperability (each language can use code written in other
languages) across several programming languages. Programs written for .NET
Framework execute in a software environment (as contrasted
to hardware environment), known as Common Language Runtime (CLR),
an application virtual machine that provides services such as security, memory
management, and exception handling. FCL and CLR together constitute .NET
Framework.

FCL provides user interface, data access, database


connectivity, cryptography, web application development, numeric algorithms,
and network communications. Programmers produce software by combining their
own source code with .NET Framework and other libraries. .NET Framework is
intended to be used by most new applications created for Windows
platform. Microsoft also produces an integrated development environment largely for
.NET software called Visual Studio.
HISTORY
Microsoft started development of .NET Framework in the late 1990s, originally
under the name of Next Generation Windows Services (NGWS). By late 2000, the
first beta versions of .NET 1.0 were released.

.NET Framework family also includes two versions for mobile or embedded
device use. A reduced version of the framework, .NET Compact Framework, is
available on Windows CE platforms, including Windows Mobile devices such
as smartphones. Additionally, .NET Micro Framework is targeted at severely
resource-constrained devices.

ARCHITECTURE

COMMON LANGUAGE INFRASTRUCTURE:


Common Language Runtime (CLI) provides a language-neutral platform for
application development and execution, including functions for exception
handling, garbage collection, security, and interoperability. By implementing the core
aspects of .NET Framework within the scope of CLI, this functionality will not be tied
to a single language but will be available across the many languages supported by the
framework. Microsoft's implementation of CLI is Common Language
Runtime (CLR). It serves as the execution engine of .NET Framework. All .NET
programs execute under the supervision of CLR, guaranteeing certain properties and
behaviors in the areas of memory management, security, and exception handling.

For computer programs to run on CLI, they need to be compiled into Common
Intermediate Language (CIL) as opposed to being compiled into machine code.
Upon execution, an architecture-specific Just-in-time compiler (JIT) turns the CIL
code into machine code. To improve performance, however, .NET Framework comes
with Native Image Generator (NGEN) that performs ahead-of-time compilation.
Figure 2: visual overview of the common language infrastructure (CLI)

CLASS LIBRARY
.NET Framework includes a set of standard class libraries. The class library is
organized in a hierarchy of namespaces. Most of the built-in APIs are part of
either System.* or Microsoft.* namespaces. These class libraries implement a large
number of common functions, such as file reading and writing, graphic rendering,
database interaction, and XML document manipulation, among others. .NET class
libraries are available to all CLI compliant languages. .NET Framework class library
is divided into two parts: Framework Class Library (FCL) and Base Class
Library (BCL).

.NET CORE
.NET Core is a free and open-source partial implementation of the .NET
Framework. It consists of CoreCLR and CoreFX, which are partial forks of CLR and
BCL respectively.NET Core comes with an improved JIT compiler, called RyuJIT.
ASSEMBLIES
Compiled CIL code is stored in CLI assemblies. As mandated by the
specification, assemblies are stored in Portable Executable (PE) file format, common
on Windows platform for all DLL and EXE files. Each assembly consists of one
or more files, one of which must contain a manifest bearing the metadata for the
assembly. The complete name of an assembly (not to be confused with the file name
on disk) contains its simple text name, version number, culture, and public key token.
Assemblies are considered equivalent if they share the same complete name,
excluding the revision of the version number. A private key can also be used by the
creator of the assembly for strong naming. The public key token identifies which
private key an assembly is signed with. Only the creator of the keypair (typically
.NET developer signing the assembly) can sign assemblies that have the same strong
name as a previous version assembly, since the creator is in possession of the private
key. Strong naming is required to add assemblies to Global Assembly Cache.

DESIGN TENETS

LANGUAGE INDEPENDENCE
.NET Framework introduces a Common Type System (CTS) that defines all
possible data types and programming constructs supported by CLR and how they may
or may not interact with each other conforming to CLI specification. Because of this
feature, .NET Framework supports the exchange of types and object instances
between libraries and applications written using any conforming .NET language.

PORTABILITY
While Microsoft has never implemented the full framework on any system
except Microsoft Windows, it has engineered the framework to be platform-
agnostic, and cross-platform implementations are available for other operating
systems. Microsoft submitted the specifications for CLI (which includes the core class
libraries, CTS, and CIL), and C++/CLI to both ECMA and ISO, making them
available as official standards. This makes it possible for third parties to create
compatible implementations of the framework and its languages on other platforms.

SECURITY
.NET Framework has its own security mechanism with two general
features: Code Access Security (CAS), and validation and verification. CAS is based
on evidence that is associated with a specific assembly. Typically the evidence is the
source of the assembly (whether it is installed on the local machine or has been
downloaded from the intranet or Internet). CAS uses evidence to determine the
permissions granted to the code. Other code can demand that calling code be granted a
specified permission. The demand causes CLR to perform a call stack walk: every
assembly of each method in the call stack is checked for the required permission; if
any assembly is not granted the permission a security exception is thrown.

MEMORY MANAGEMENT
CLR frees the developer from the burden of managing memory (allocating and
freeing up when done); it handles memory management itself by detecting when
memory can be safely freed. Instantiations of .NET types (objects) are allocated from
the managed heap; a pool of memory managed by CLR. As long as there exists a
reference to an object, which might be either a direct reference to an object or via
a graph of objects, the object is considered to be in use. When there is no reference to
an object, and it cannot be reached or used, it becomes garbage, eligible for collection.
.NET Framework includes a garbage collector which runs periodically, on a
separate thread from the application's thread, that enumerates all the unusable objects
and reclaims the memory allocated to them and this is more effcient then the java.

SIMPLIFIED DEPLOYMENT
.NET Framework includes design features and tools which help manage the
installation of computer software to ensure that it does not interfere with previously
installed software, and that it conforms to security requirements.
Features Of . Net:

Microsoft .NET is a set of Microsoft software technologies for rapidly building


and integrating XML Web services, Microsoft Windows-based applications, and Web
solutions. The .NET Framework is a language-neutral platform for writing programs
that can easily and securely interoperate. Theres no language barrier with .NET: there
are numerous languages available to the developer including Managed C++, C#,
Visual Basic and Java Script. The .NET framework provides the foundation for
components to interact seamlessly, whether locally or remotely on different platforms.
It standardizes common data types and communications protocols so that components
created in different languages can easily interoperate.

.NET is also the collective name given to various software components built
upon the .NET platform. These will be both products (Visual Studio.NET and
Windows.NET Server, for instance) and services (like Passport, .NET My Services,
and so on).

THE .NET FRAMEWORK

The .NET Framework has two main parts:

1. The Common Language Runtime (CLR).

2. A hierarchical set of class libraries.

The CLR is described as the execution engine of .NET. It provides the


environment within which programs run. The most important features are

Conversion from a low-level assembler-style language, called


Intermediate Language (IL), into code native to the platform being
executed on.
Memory management, notably including garbage collection.
Checking and enforcing security restrictions on the running code.
Loading and executing programs, with version control and other such
features.
The following features of the .NET framework are also worth
description:

Managed Code:

The code that targets .NET, and which contains certain extra Information-
metadata - to describe itself. Whilst both managed and unmanaged code can run in
the runtime, only managed code contains the information that allows the CLR to
guarantee, for instance, safe execution and interoperability.

Managed Data

With Managed Code comes Managed Data. CLR provides memory


allocation and Deal location facilities, and garbage collection. Some .NET languages
use Managed Data by default, such as C#, Visual Basic.NET and JScript.NET,
whereas others, namely C++, do not. Targeting CLR can, depending on the language
youre using, impose certain constraints on the features available. As with managed
and unmanaged code, one can have both managed and unmanaged data in .NET
applications - data that doesnt get garbage collected but instead is looked after by
unmanaged code.

Common Type System

The CLR uses something called the Common Type System (CTS) to strictly
enforce type-safety. This ensures that all classes are compatible with each other, by
describing types in a common way. CTS define how types work within the runtime,
which enables types in one language to interoperate with types in another language,
including cross-language exception handling. As well as ensuring that types are only
used in appropriate ways, the runtime also ensures that code doesnt attempt to access
memory that hasnt been allocated to it.
Common Language Specification

The CLR provides built-in support for language interoperability. To ensure


that you can develop managed code that can be fully used by developers using any
programming language, a set of language features and rules for using them called the
Common Language Specification (CLS) has been defined. Components that follow
these rules and expose only CLS features are considered CLS-compliant.

THE CLASS LIBRARY

.NET provides a single-rooted hierarchy of classes, containing over


7000 types. The root of the namespace is called System; this contains basic types like
Byte, Double, Boolean, and String, as well as Object. All objects derive from System.
Object. As well as objects, there are value types. Value types can be allocated on the
stack, which can provide useful flexibility. There are also efficient means of
converting value types to object types if and when necessary.

The set of classes is pretty comprehensive, providing collections, file,


screen, and network I/O, threading, and so on, as well as XML and database
connectivity.

The class library is subdivided into a number of sets (or namespaces),


each providing distinct areas of functionality, with dependencies between the
namespaces kept to a minimum.

OVERLOADING

Overloading is another feature in C#. Overloading enables us to define multiple


procedures with the same name, where each procedure has a different set of
arguments. Besides using overloading for procedures, we can use it for constructors
and properties in a class.
MULTITHREADING:

C#.NET also supports multithreading. An application that supports


multithreading can handle multiple tasks simultaneously, we can use multithreading
to decrease the time taken by an application to respond to user interaction.

STRUCTURED EXCEPTION HANDLING

C#.NET supports structured handling, which enables us to detect and remove


errors at runtime. In C#.NET, we need to use TryCatchFinally statements to
create exception handlers. Using TryCatchFinally statements, we can create
robust and effective exception handlers to improve the performance of our
application.

THE .NET FRAMEWORK

The .NET Framework is a new computing platform that simplifies application


development in the highly distributed environment of the Internet.

OBJECTIVES OF. NET FRAMEWORK

1. To provide a consistent object-oriented programming environment whether


object codes is stored and executed locally on Internet-distributed, or executed
remotely.

2. To provide a code-execution environment to minimizes software deployment and


guarantees safe execution of code.

3. Eliminates the performance problems.

There are different types of application, such as Windows-based applications and


Web-based applications.
MICROSOFT SQL SERVER

Microsoft SQL Server is a relational database management system developed


by Microsoft. As a database, it is a software product whose primary function is to
store and retrieve data as requested by other software applications, be it those on the
same computer or those running on another computer across a network (including the
Internet). There are at least a dozen different editions of Microsoft SQL Server aimed
at different audiences and for workloads ranging from small single-machine
applications to large Internet-facing applications with many concurrent users. Its
primary query languages are T-SQL and ANSI SQL.

HISTORY:

GENESIS
Prior to version 7.0 the code base for MS SQL Server was sold by Sybase SQL
Server to Microsoft, and was Microsoft's entry to the enterprise-level database market,
competing against Oracle, IBM, and, later, Sybase. Microsoft, Sybase and Ashton-
Tate originally worked together to create and market the first version named SQL
Server 1.0 for OS/2 (about 1989) which was essentially the same as Sybase SQL
Server 3.0 on Unix,VMS, etc.

Since the release of SQL Server 2000, advances have been made in performance, the
client IDE tools, and several complementary systems that are packaged with SQL
Server 2005. These include:

an extract-transform-load (ETL) tool (SQL Server Integration Services or SSIS)


a Reporting Server
an OLAP and data mining server (Analysis Services)

Common Language Runtime (CLR) integration was introduced with this


version, enabling one to write SQL code as Managed Code by the CLR. For relational
data, T-SQL has been augmented with error handling features (try/catch) and support
for recursive queries with CTEs (Common Table Expressions). SQL Server 2005 has
also been enhanced with new indexing algorithms, syntax and better error recovery
systems.

FEATURES SQL SERVER:

The OLAP Services feature available in SQL Server version 7.0 is now called
SQL Server 2000 Analysis Services. The term OLAP Services has been replaced with
the term Analysis Services. Analysis Services also includes a new data mining
component. The Repository component available in SQL Server version 7.0 is now
called Microsoft SQL Server 2000 Meta Data Services. References to the component
now use the term Meta Data Services. The term repository is used only in reference to
the repository engine within Meta Data Services

SQL-SERVER database consist of six type of objects,

They are,

1. TABLE

2. QUERY

3. FORM

4. REPORT

5. MACRO

TABLE:

A database is a collection of data about a specific topic.

VIEWS OF TABLE:

We can work with a table in two types,

1. Design View

2. Datasheet View
Design View

To build or modify the structure of a table we work in the table design view.
We can specify what kind of data will be hold.

Datasheet View

To add, edit or analyses the data itself we work in tables datasheet view mode.

QUERY:

A query is a question that has to be asked the data. Access gathers data that
answers the question from one or more table. The data that make up the answer is
either dynaset (if you edit it) or a snapshot (it cannot be edited).Each time we run
query, we get latest information in the dynaset. Access either displays the dynaset or
snapshot for us to view or perform an action on it, such as deleting or updating.
CHAPTER 8

INPUT DESIGN AND OUTPUT DESIGN

INPUT DESIGN

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

What data should be given as input?


How the data should be arranged or coded?
The dialog to guide the operating personnel in providing input.
Methods for preparing input validations and steps to follow when error
occur.

OBJECTIVES

1.Input Design is the process of converting a user-oriented description of the


input into a computer-based system. This design is important to avoid errors in
the data input process and show the correct direction to the management for
getting correct information from the computerized system.

2. It is achieved by creating user-friendly screens for the data entry to handle


large volume of data. The goal of designing input is to make data entry easier
and to be free from errors. The data entry screen is designed in such a way that
all the data manipulates can be performed. It also provides record viewing
facilities.

3.When the data is entered it will check for its validity. Data can be entered with
the help of screens. Appropriate messages are provided as when needed so that
the user

will not be in maize of instant. Thus the objective of input design is to create an
input layout that is easy to follow

OUTPUT DESIGN

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

1. Designing computer output should proceed in an organized, well thought out


manner; the right output must be developed while ensuring that each output
element is designed so that people will find the system can use easily and
effectively. When analysis design computer output, they should Identify the
specific output that is needed to meet the requirements.

2.Select methods for presenting information.

3.Create document, report, or other formats that contain information produced


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

Convey information about past activities, current status or projections of


the
Future.
Signal important events, opportunities, problems, or warnings.
Trigger an action.
Confirm an action.
CHAPTER 9

SYSTEM DESIGN

Systems design is the process of defining the architecture, components,


modules, interfaces, and data for a system to satisfy specified requirements. Systems
design could be seen as the application of systems theory to product development.

DATAFLOW DIAGRAM:

A Data Flow Diagram (DFD) is a geo graphical representation of the "flow" of


data through an information system, modeling its process aspects. A DFD is often
used as a preliminary step to create an overview of the system, which can later be
elaborated. DFDs can also be used for the visualization of data processing.

It is common practice to draw the context-level data flow diagram first, which
shows the interaction between the system and external agents which act as data
sources and data sinks. This helps to create an accurate drawing in the context
diagram. The system's interactions with the outside world are modeled purely in
terms of data flows across the system boundary. The context diagram shows the
entire system as a single process, and gives no clues as to its internal organization.
Login

CLIENT ADMIN
Check

no
Exists Sign Up Exists

yes yes

Upload Files
File Request
vai Router

no View Requet
File Receive Check Files
with packets ipaddress?

yes
Download File File Verification
with security No Check
packet's receive verification?

packet's Yes Proceed Files


not receive
Response
To Client

Not Response Speed Violation


To Client

End

SEQUENCE DIAGRAM:
A Sequence diagram is an interaction diagram that shows how processes
operate with one another and what is their order. It is a construct of a Message
Sequence Chart. A sequence diagram shows object interactions arranged in time
sequence. It depicts the objects and classes involved in the scenario and the
sequence of messages exchanged between the objects needed to carry out the
functionality of the scenario. Sequence diagrams are typically associated with
use case realizations in the Logical View of the system under development. Sequence
diagrams are sometimes called event diagrams or event scenarios.

A sequence diagram shows, as parallel vertical lines (lifelines), different


processes or objects that live simultaneously, and, as horizontal arrows, the
messages exchanged between them, in the order in which they occur. This allows the
specification of simple runtime scenarios in a graphical manner.
SERVER ROUTER
CLIENT

Upload Files

View Upload Files

Request Upload Files

Receive Request Files

Verify and Proceed Files

Socket Connection

Socket Connection
Speed Violation

IP Address
Energy

Energy

File Receive with Packets

file received

Download File
USE CASE DIAGRAM:

To model a system the most important aspect is to capture the dynamic


behaviour. To clarify a bit in details, dynamic behaviour means the behaviour of the
system when it is running /operating. So only static behaviour is not sufficient to
model a system rather dynamic behaviour is more important than static behaviour.

In UML there are five diagrams available to model dynamic nature and use
case diagram is one of them. Now as we have to discuss that the use case diagram is
dynamic in nature there should be some internal or external factors for making the
interaction. These internal and external agents are known as actors. So use case
diagrams are consists of actors, use cases and their relationships.

The diagram is used to model the system/subsystem of an application. A single


use case diagram captures a particular functionality of a system. So to model the entire
system numbers of use case diagrams are used. A use case diagram at its simplest is a
representation of a user's interaction with the system and depicting the specifications
of a use case. A use case diagram can portray the different types of users of a system
and the case and will often be accompanied by other types of diagrams as well.
Create Account

Login

File Upload

Admin File Request


Client

Socet Connection

File Receive
with packets

View & Download


Results

File Transfer
Activity Diagram:

Activity diagrams are graphical representations of workflows of stepwise activities


and actions with support for choice, iteration and concurrency. In the Unified
Modeling Language, activity diagrams are intended to model both computational and
organisational processes (i.e. workflows).Activity diagrams show the overall flow of
control.
LOGIN

ADMIN CLIENT

No
Upload Files Sign Up Exists

Yes

View Client View Upload


File Request Files

yes Check
no
ipaddress?

File Request
Verify Request
File Received

File Received
With Packets
Proceed Files
File Not
Received

File Download
No socket Yes
connection

Not Response Response


To Client To Client

CLASS DIAGRAM:
In software engineering, a class diagram in the Unified Modeling
Language (UML) is a type of static structure diagram that describes the structure of a
system by showing the system's classes, their attributes, operations (or methods),
and the relationships among objects.

The class diagram is the main building block of object oriented modelling. It is
used both for general conceptual modelling of the systematics of the application, and
for detailed modelling translating the models into programming code. Class diagrams
can also be used for data modeling. The classes in a class diagram represent both the
main objects, interactions in the application and the classes to be programmed.

A class with three sections.

In the diagram, classes are represented with boxes which contain three parts:

The top part contains the name of the class. It is printed in bold and
centered, and the first letter is capitalized.

The middle part contains the attributes of the class. They are left-
aligned and the first letter is lowercase.

The bottom part contains the methods the class can execute. They are
also left-aligned and the first letter is lowercase.

In the design of a system, a number of classes are identified and grouped


together in a class diagram which helps to determine the static relations between
those objects. With detailed modelling, the classes of the conceptual design are
often split into a number of subclasses. In order to further describe the behaviour of
systems, these class diagrams can be complemented by a state diagram or UML state
machine.

MEMBERS:

UML provides mechanisms to represent class members, such as attributes and


methods, and additional information about them.

Visibility

To specify the visibility of a class member (i.e., any attribute or method), these
notations must be placed before the member's name:

+ Public

- Private

# Protected

/ Derived (can be combined with one of the others)

~ Package

Scopes

The UML specifies two types of scope for members: instance and classifier.[4]

Classifier members are commonly recognized as static in many


programming languages. The scope is the class itself.
Attribute values are equal for all instances
Method invocation does not affect the instances state
Instance members are scoped to a specific instance.
Attribute values may vary between instances
Method invocation may affect the instances state (i.e., change instances
attributes)

To indicate a classifier scope for a member, its name must be underlined.


Otherwise, instance scope is assumed by default.

Login Account File Upload


ID FileID
Name FileName
LoginID FileBytes
Password FileExtension
Mobile FileSize
EMail FileRequestName
LoginType FileStatus

Loginidgenration() upload()
CreateAccount() fileidgenration()
CHAPTER 10

SYSTEM STUDY

FEASIBILITY STUDY:

The feasibility of the project is analyzed in this phase and business


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

Three key considerations involved in the feasibility analysis are

Economical feasibility

Technical feasibility

Social feasibility

ECONOMICAL FEASIBILITY:

This study is carried out to check the economic impact that the system
will have on the organization. The amount of fund that the company can pour
into the research and development of the system is limited. The expenditures
must be justified. Thus the developed system as well within the budget and this
was achieved because most of the technologies used are freely available. Only
the customized products had to be purchased.
TECHNICAL FEASIBILITY:

This study is carried out to check the technical feasibility, that is, the
technical requirements of the system. Any system developed must not have a
high demand on the available technical resources. This will lead to high
demands on the available technical resources. This will lead to high demands
being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing this
system.

SOCIAL FEASIBILITY:

The aspect of study is to check the level of acceptance of the system by


the user. This includes the process of training the user to use the system
efficiently. The user must not feel threatened by the system, instead must accept
it as a necessity. The level of acceptance by the users solely depends on the
methods that are employed to educate the user about the system and to make
him familiar with it. His level of confidence must be raised so that he is also
able to make some constructive criticism, which is welcomed, as he is the final
user of the system.
CHAPTER 11

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:
Testing is the process of trying to discover every conceivable fault or
weakness in a work product. The different type of testing are given below:

UNIT TESTING:

Unit testing involves the design of test cases that validate that the internal
program logic is functioning properly, and that program inputs 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:
Functional tests provide systematic demonstrations that functions tested are
available as specified by the business and technical requirements, system
documentation, and user manuals.
Functional testing is centered on the following items:

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


Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be
exercised.
Systems/ Procedures: interfacing systems or procedures must be invoked.

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.
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.

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.
Test Results: All the test cases mentioned above passed successfully. No
defects encountered.

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.
Test Results: All the test cases mentioned above passed successfully. No
defects encountered
CHAPTER 12

SOURCE CODE

REGISTER:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Data.SqlClient;
using System.Configuration;

namespace Clients
{
public partial class Form2 : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
Class1 cs = new Class1();
string p1, p2;

public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)


{
textBox1.Text = Convert.ToString(cs.idgeneration());
}

private void button1_Click(object sender, EventArgs e)


{
if (textBox2.Text == "")
{
MessageBox.Show("Enter Your Name.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
if (textBox3.Text == "")
{
MessageBox.Show("Enter LoginID.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
if (textBox4.Text == "")
{
MessageBox.Show("Enter Password.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
if (textBox5.Text == "")
{
MessageBox.Show("Enter Mobile.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
if (textBox6.Text == "")
{
MessageBox.Show("Enter EmailID.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{

SqlConnection con = new SqlConnection(constring);

SqlDataAdapter adp = new SqlDataAdapter("Select


LoginID from Register", con);
DataSet ds = new DataSet();
adp.Fill(ds);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
p1 = ds.Tables[0].Rows[i]["loginid"].ToString();
if (p1 == textBox2.Text)
{
p2 = "yes";
MessageBox.Show("LoginID aready Exists.Please
enter another LoginID.", "Message Box", MessageBoxButtons.OK, MessageBoxIcon.Warning);
goto Outer;
}
p1 = "";
}
if (p2 != "yes")
{

con.Open();
SqlCommand cmd = new SqlCommand("insert into
Register values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text +
"','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "')", con);
cmd.ExecuteNonQuery();

DialogResult dlgResult =
MessageBox.Show("REGISTRATION SUCCESS..", "Message Box", MessageBoxButtons.OK,
MessageBoxIcon.Information);

if (dlgResult == DialogResult.OK)
{
textBox1.Text =
Convert.ToString(cs.idgeneration());
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
}
}
}
}
Outer:
p2 = "";
}
}
}
}

private void button2_Click(object sender, EventArgs e)


{
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
}

//private void textBox4_TextChanged(object sender, EventArgs e)


//{

//}

private void label5_Click(object sender, EventArgs e)


{

private void textBox6_TextChanged(object sender, EventArgs e)


{

private void label4_Click(object sender, EventArgs e)


{

private void textBox5_TextChanged(object sender, EventArgs e)


{

private void label3_Click(object sender, EventArgs e)


{

private void label9_Click(object sender, EventArgs e)


{

private void label2_Click(object sender, EventArgs e)


{

private void textBox3_TextChanged(object sender, EventArgs e)


{

}
private void label1_Click(object sender, EventArgs e)
{

private void textBox2_TextChanged(object sender, EventArgs e)


{

private void label8_Click(object sender, EventArgs e)


{

private void textBox1_TextChanged(object sender, EventArgs e)


{

private void label7_Click(object sender, EventArgs e)


{

}
}

LOGIN:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using System.Net.Sockets;
using System.Net;
using System.IO;

namespace Clients
{
public partial class Form1 : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
string p1, p2, p3;
int totreqcount;
string rproceedstatus = "Proceed", empty = "";

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{
//string mydocpath =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

ToolTip toolTip1 = new ToolTip();

toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 500;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
toolTip1.SetToolTip(this.pictureBox7, "Click To Reload");
toolTip1.SetToolTip(this.pictureBox1, "Click To User Login");
toolTip1.SetToolTip(this.label3, "Click To User Login");
toolTip1.SetToolTip(this.pictureBox2, "Click To User Register");
toolTip1.SetToolTip(this.label4, "Click To User Register");
toolTip1.SetToolTip(this.pictureBox8, "Click To File Request");
toolTip1.SetToolTip(this.label9, "Click To File Request");
toolTip1.SetToolTip(this.pictureBox3, "Click To Start Transaction");
toolTip1.SetToolTip(this.label5, "Click To Start Transaction");

SqlConnection con = new SqlConnection(constring);


con.Open();
SqlCommand cmd = new SqlCommand("Delete From FileUpload", con);
cmd.ExecuteNonQuery();
con.Close();
}

private void pictureBox1_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
}

private void label3_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
}

private void button2_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
}

private void pictureBox7_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
groupBox1.Visible = true;
pictureBox8.Enabled = false;
label9.Enabled = false;
pictureBox1.Enabled = true;
label3.Enabled = true;
pictureBox2.Enabled = true;
label4.Enabled = true;
label10.Visible = false;
label11.Visible = false;
linkLabel1.Visible = false;
label11.Text = "";
pictureBox6.Enabled = false;
}

private void button1_Click(object sender, EventArgs e)


{
if (textBox1.Text == "")
{
MessageBox.Show("Enter LoginID.", "Message Box", MessageBoxButtons.OK,
MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
}
else
{
if (textBox2.Text == "")
{
MessageBox.Show("Enter Password.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
}
else
{
SqlDataAdapter adp = new SqlDataAdapter("Select loginid,upassword
from Register where loginid='" + textBox1.Text + "'and upassword='" + textBox2.Text +
"'", constring);
DataSet ds = new DataSet();
adp.Fill(ds);

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)


{
p1 = ds.Tables[0].Rows[i]["loginid"].ToString();
p2 = ds.Tables[0].Rows[i]["upassword"].ToString();

if (p1 == textBox1.Text && p2 == textBox2.Text)


{
p3 = "yes";
goto Outer;
}
}
Outer:
p1 = "";
p2 = "";
if (p3 == "yes")
{
p3 = null;
pictureBox8.Enabled = true;
label9.Enabled = true;
groupBox1.Visible = false;
label10.Visible = true;
label11.Visible = true;
label11.Text = textBox1.Text;
linkLabel1.Visible = true;
pictureBox1.Enabled = false;
label3.Enabled = false;
pictureBox2.Enabled = false;
label4.Enabled = false;
pictureBox6.Enabled = false;
}
else
{
MessageBox.Show("Enter Correct LoginID/Password.", "Message
Box", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}

private void pictureBox2_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
Form2 frm2 = new Form2();
frm2.ShowDialog();
pictureBox6.Enabled = false;
}

private void label4_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
Form2 frm2 = new Form2();
frm2.ShowDialog();
pictureBox6.Enabled = false;
}

private void linkLabel1_LinkClicked(object sender,


LinkLabelLinkClickedEventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
groupBox1.Visible = true;
pictureBox8.Enabled = false;
label9.Enabled = false;
label10.Visible = false;
label11.Visible = false;
linkLabel1.Visible = false;
label11.Text = "";
pictureBox1.Enabled = true;
label3.Enabled = true;
pictureBox2.Enabled = true;
pictureBox6.Enabled = false;
label4.Enabled = true;
label2.Visible = true;
}

private void pictureBox8_Click(object sender, EventArgs e)


{
FileRequest fr = new FileRequest(label11.Text);
fr.ShowDialog();
}

private void label9_Click(object sender, EventArgs e)


{
FileRequest fr = new FileRequest(label11.Text);
fr.ShowDialog();
}

private void pictureBox3_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();

SqlDataAdapter adp1 = new SqlDataAdapter("Select COUNT(rstatus) as


reqstatus from FileUpload where rstatus='" + rproceedstatus + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
totreqcount =
Convert.ToInt32(ds1.Tables[0].Rows[0]["reqstatus"].ToString());
if (totreqcount == 3)
{
//START TRANSACTION
Transaction tr = new Transaction();
tr.ShowDialog();
}
else
{
MessageBox.Show("ERROR - SERVER DO NOT VERIFY FILES.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

con.Close();
}

private void label5_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();

SqlDataAdapter adp1 = new SqlDataAdapter("Select COUNT(rstatus) as


reqstatus from FileUpload where rstatus='" + rproceedstatus + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
totreqcount =
Convert.ToInt32(ds1.Tables[0].Rows[0]["reqstatus"].ToString());
if (totreqcount == 3)
{
//START TRANSACTION
Transaction tr = new Transaction();
tr.ShowDialog();
}
else
{
MessageBox.Show("ERROR - SERVER DO NOT VERIFY FILES.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

con.Close();
}

private void label2_Click(object sender, EventArgs e)


{
label2.Visible = true;
}

private void pictureBox6_Click(object sender, EventArgs e)


{

private void groupBox1_Enter(object sender, EventArgs e)


{

}
}
File Request:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace Clients
{
public partial class FileRequest : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
string rstatus = "Request", rproceedstatus = "Proceed", ruploadstatus =
"Upload";
int count = 1, totreqcount, totreqcount1;

public FileRequest(string userid)


{
InitializeComponent();
label9.Text = userid;
}

private void FileRequest_Load(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();
SqlDataAdapter adp = new SqlDataAdapter("Select * from FileUpload", con);
DataSet ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count == 3)
{
comboBox1.Items.Insert(0, "--SELECT--");
comboBox1.SelectedIndex = 0;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
comboBox1.Items.Add(ds.Tables[0].Rows[i]["id"].ToString());
}
con.Close();
}
else
{
SqlDataAdapter adp1 = new SqlDataAdapter("Select * from FileUpload
where rstatus='" + rstatus + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
if (ds1.Tables[0].Rows.Count == 3)
{
MessageBox.Show("Warning : Files Already Request !.", "Message
Box", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(constring);

if (count == 1)
{

}
else
{
if (comboBox1.SelectedIndex == 0)
{
btnrequest.Enabled = false;
label3.Text = "....................";
label4.Text = "....................";
label5.Text = "....................";
MessageBox.Show("Select Any One File ID.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
con.Open();
SqlDataAdapter adp = new SqlDataAdapter("Select * from FileUpload
where id='" + comboBox1.SelectedItem.ToString() + "'", con);
DataSet ds = new DataSet();
adp.Fill(ds);
label3.Text = ds.Tables[0].Rows[0]["ufilename"].ToString();
label4.Text = ds.Tables[0].Rows[0]["ufilesize"].ToString();
label5.Text = ds.Tables[0].Rows[0]["ufileext"].ToString();
con.Close();
btnrequest.Enabled = true;
}
}
count++;
}

private void btnrequest_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();

SqlDataAdapter adp1 = new SqlDataAdapter("Select COUNT(rstatus) as


reqstatus from FileUpload where rstatus='" + rproceedstatus + "'", con);
DataSet ds1= new DataSet();
adp1.Fill(ds1);
totreqcount1 =
Convert.ToInt32(ds1.Tables[0].Rows[0]["reqstatus"].ToString());
if (totreqcount1 != 0)
{
btnrequest.Enabled = false;
comboBox1.Enabled = false;
label3.Text = "....................";
label4.Text = "....................";
label5.Text = "....................";
MessageBox.Show("DO NOT ACCESS - FILES ARE PROCESSING..", "Message
Box", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
SqlDataAdapter adp = new SqlDataAdapter("Select COUNT(rstatus) as
reqstatus from FileUpload where rstatus='" + rstatus + "'", con);
DataSet ds = new DataSet();
adp.Fill(ds);
totreqcount =
Convert.ToInt32(ds.Tables[0].Rows[0]["reqstatus"].ToString());
if (totreqcount < 3)
{
SqlCommand cmd = new SqlCommand("Update FileUpload Set
rusername='" + label9.Text + "' where id='" + comboBox1.SelectedItem.ToString() + "'",
con);
cmd.ExecuteNonQuery();
SqlCommand cmd1 = new SqlCommand("Update FileUpload Set rstatus='"
+ rstatus + "' where id='" + comboBox1.SelectedItem.ToString() + "'", con);
cmd1.ExecuteNonQuery();

DialogResult dlgResult = MessageBox.Show("REQUEST SENT


SUCCESSFULLY..", "Message Box", MessageBoxButtons.OK, MessageBoxIcon.Information);

if (dlgResult == DialogResult.OK)
{
btnrequest.Enabled = false;
//comboBox1.SelectedIndex = 0;
label3.Text = "....................";
label4.Text = "....................";
label5.Text = "....................";
}
}
else
{
DialogResult dlgResult1 = MessageBox.Show("BUFFER OVERFLOW(3
request only)..", "Message Box", MessageBoxButtons.OK, MessageBoxIcon.Information);

if (dlgResult1 == DialogResult.OK)
{
btnrequest.Enabled = false;
//comboBox1.SelectedIndex = 0;
label3.Text = "....................";
label4.Text = "....................";
label5.Text = "....................";
}
}
con.Close();
}
}

private void button2_Click(object sender, EventArgs e)


{
btnrequest.Enabled = false;
label3.Text = "....................";
label4.Text = "....................";
label5.Text = "....................";
MessageBox.Show("Select One File.", "Message Box", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}

}
}

Transaction:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using System.Net;
using System.Net.Sockets;
using System.IO;

namespace Clients
{
public partial class Transaction : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
string reqstatus;
int count, filesize1, filesize2, filesize3, eachfilesize, totalfilesize;
string filename1, filename2, filename3, filenames, totalbytes;
string username1, username2, username3;
double tstart, tcalc, tend;

public Transaction()
{
InitializeComponent();
}

Clients obj = new Clients();

private void Transaction_Load(object sender, EventArgs e)


{
//label1.BackColor = System.Drawing.Color.LightGreen;
backgroundWorker1.RunWorkerAsync();

SqlConnection con = new SqlConnection(constring);

con.Open();

SqlDataAdapter adp3 = new SqlDataAdapter("Select * from FileUpload", con);


DataSet ds3 = new DataSet();
adp3.Fill(ds3);

for (int i = 0; i < ds3.Tables[0].Rows.Count; i++)


{
reqstatus = ds3.Tables[0].Rows[i]["rstatus"].ToString();

if (reqstatus == "Proceed")
{
count++;
if (count == 1)
{
groupBox1.Text = "CLIENT - 1 ( " +
ds3.Tables[0].Rows[i]["rusername"].ToString() + " )";
username1 = ds3.Tables[0].Rows[i]["rusername"].ToString();
filesize1 =
Convert.ToInt32(ds3.Tables[0].Rows[i]["ufilesize"].ToString());
eachfilesize = filesize1 / 10;
label16.Text = Convert.ToString(filesize1) + " bytes";
label15.Text = Convert.ToString(eachfilesize) + " bytes";
filename1 = ds3.Tables[0].Rows[i]["ufilename"].ToString();
}
else
{
if (count == 2)
{
groupBox3.Text = "CLIENT - 2 ( " +
ds3.Tables[0].Rows[i]["rusername"].ToString() + " )";
username2 = ds3.Tables[0].Rows[i]["rusername"].ToString();
filesize2 =
Convert.ToInt32(ds3.Tables[0].Rows[i]["ufilesize"].ToString());
eachfilesize = filesize2 / 10;
label17.Text = Convert.ToString(filesize2) + " bytes";
label18.Text = Convert.ToString(eachfilesize) + " bytes";
filename2 = ds3.Tables[0].Rows[i]["ufilename"].ToString();
}
else
{
if (count == 3)
{
groupBox7.Text = "CLIENT - 3 ( " +
ds3.Tables[0].Rows[i]["rusername"].ToString() + " )";
username3 =
ds3.Tables[0].Rows[i]["rusername"].ToString();
filesize3 =
Convert.ToInt32(ds3.Tables[0].Rows[i]["ufilesize"].ToString());
eachfilesize = filesize3 / 10;
totalfilesize = filesize1 + filesize2 + filesize3;
totalbytes = Convert.ToString(totalfilesize) + "
(Bytes) Are Received";
label31.Text = Convert.ToString(filesize3) + " bytes";
label32.Text = Convert.ToString(eachfilesize) + "
bytes";
filename3 =
ds3.Tables[0].Rows[i]["ufilename"].ToString();
}
}
}
}
}
}

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)


{
obj.StartServer();
}

private void timer1_Tick(object sender, EventArgs e)


{
if (Clients.Rout == "Start")
{
timer1.Enabled = false;
Receiving();
Clients.Rout = "";
}
}

public void Receiving()


{
tstart = Convert.ToDouble(DateTime.Now.Millisecond);
//CLIENT - 1
System.Threading.Thread.Sleep(1000);
label1.Text = "Pending";
label4.Text = "Pending";
label5.Text = "Pending";
label8.Text = "Pending";
label9.Text = "Pending";
label10.Text = "Pending";
label11.Text = "Pending";
label12.Text = "Pending";
label13.Text = "Pending";
label14.Text = "Pending";
//CLIENT - 2
label19.Text = "Pending";
label20.Text = "Pending";
label21.Text = "Pending";
label22.Text = "Pending";
label23.Text = "Pending";
label24.Text = "Pending";
label25.Text = "Pending";
label26.Text = "Pending";
label27.Text = "Pending";
label28.Text = "Pending";
//CLIENT - 3
label33.Text = "Pending";
label34.Text = "Pending";
label35.Text = "Pending";
label36.Text = "Pending";
label37.Text = "Pending";
label38.Text = "Pending";
label39.Text = "Pending";
label40.Text = "Pending";
label41.Text = "Pending";
label42.Text = "Pending";
System.Threading.Thread.Sleep(1000);
Random rn = new Random();
// int rnno = rn.Next(125, 128);
int rnno = 128;
if (rnno == 125)
{
tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;
tcalc = tend;
//Packet - 1
label1.Text = "Processing..";
label1.ForeColor = System.Drawing.Color.Yellow;
label28.Text = "Processing..";
label28.ForeColor = System.Drawing.Color.Yellow;
label42.Text = "Processing..";
label42.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button1.BackColor = Color.Lime;
button20.BackColor = Color.Lime;
button30.BackColor = Color.Lime;
label1.Text = "Receive";
label1.ForeColor = System.Drawing.Color.Lime;
label28.Text = "Receive";
label28.ForeColor = System.Drawing.Color.Lime;
label42.Text = "Receive";
label42.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;
tcalc = tcalc + tend;
//Packet - 2
label4.Text = "Processing..";
label4.ForeColor = System.Drawing.Color.Yellow;
label27.Text = "Processing..";
label27.ForeColor = System.Drawing.Color.Yellow;
label41.Text = "Processing..";
label41.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button2.BackColor = Color.Lime;
button19.BackColor = Color.Lime;
button29.BackColor = Color.Lime;
label4.Text = "Receive";
label4.ForeColor = System.Drawing.Color.Lime;
label27.Text = "Receive";
label27.ForeColor = System.Drawing.Color.Lime;
label41.Text = "Receive";
label41.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 3
//Energy On Client - 3
label5.Text = "Processing..";
label5.ForeColor = System.Drawing.Color.Yellow;
label26.Text = "Processing..";
label26.ForeColor = System.Drawing.Color.Yellow;
label40.Text = "Processing..";
label40.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button3.BackColor = Color.Lime;
button18.BackColor = Color.Lime;
button28.BackColor = Color.Red;
label40.Text = "Delay";
label40.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label5.Text = "Receive";
label5.ForeColor = System.Drawing.Color.Lime;
label26.Text = "Receive";
label26.ForeColor = System.Drawing.Color.Lime;
label40.Text = "Energy";
label40.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button28.BackColor = Color.Lime;
label40.Text = "Receive";
label40.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 4
//Energy On Client - 1
label8.Text = "Processing..";
label8.ForeColor = System.Drawing.Color.Yellow;
label25.Text = "Processing..";
label25.ForeColor = System.Drawing.Color.Yellow;
label39.Text = "Processing..";
label39.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button4.BackColor = Color.Red;
button17.BackColor = Color.Lime;
button27.BackColor = Color.Lime;
label8.Text = "Delay";
label8.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label25.Text = "Receive";
label25.ForeColor = System.Drawing.Color.Lime;
label39.Text = "Receive";
label39.ForeColor = System.Drawing.Color.Lime;
label8.Text = "Energy";
label8.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button4.BackColor = Color.Lime;
label8.Text = "Receive";
label8.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 5
label9.Text = "Processing..";
label9.ForeColor = System.Drawing.Color.Yellow;
label24.Text = "Processing..";
label24.ForeColor = System.Drawing.Color.Yellow;
label38.Text = "Processing..";
label38.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button5.BackColor = Color.Lime;
button16.BackColor = Color.Lime;
button26.BackColor = Color.Lime;
label9.Text = "Receive";
label9.ForeColor = System.Drawing.Color.Lime;
label24.Text = "Receive";
label24.ForeColor = System.Drawing.Color.Lime;
label38.Text = "Receive";
label38.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 6
label10.Text = "Processing..";
label10.ForeColor = System.Drawing.Color.Yellow;
label23.Text = "Processing..";
label23.ForeColor = System.Drawing.Color.Yellow;
label37.Text = "Processing..";
label37.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button6.BackColor = Color.Lime;
button15.BackColor = Color.Lime;
button25.BackColor = Color.Lime;
label10.Text = "Receive";
label10.ForeColor = System.Drawing.Color.Lime;
label23.Text = "Receive";
label23.ForeColor = System.Drawing.Color.Lime;
label37.Text = "Receive";
label37.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 7
label11.Text = "Processing..";
label11.ForeColor = System.Drawing.Color.Yellow;
label22.Text = "Processing..";
label22.ForeColor = System.Drawing.Color.Yellow;
label36.Text = "Processing..";
label36.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button7.BackColor = Color.Lime;
button14.BackColor = Color.Lime;
button24.BackColor = Color.Lime;
label11.Text = "Receive";
label11.ForeColor = System.Drawing.Color.Lime;
label22.Text = "Receive";
label22.ForeColor = System.Drawing.Color.Lime;
label36.Text = "Receive";
label36.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 8
label12.Text = "Processing..";
label12.ForeColor = System.Drawing.Color.Yellow;
label21.Text = "Processing..";
label21.ForeColor = System.Drawing.Color.Yellow;
label35.Text = "Processing..";
label35.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button8.BackColor = Color.Lime;
button13.BackColor = Color.Red;
button23.BackColor = Color.Lime;
label21.Text = "Delay";
label21.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label12.Text = "Receive";
label12.ForeColor = System.Drawing.Color.Lime;
label35.Text = "Receive";
label35.ForeColor = System.Drawing.Color.Lime;
label21.Text = "Energy";
label21.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button13.BackColor = Color.Lime;
label21.Text = "Receive";
label21.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 9
label13.Text = "Processing..";
label13.ForeColor = System.Drawing.Color.Yellow;
label20.Text = "Processing..";
label20.ForeColor = System.Drawing.Color.Yellow;
label34.Text = "Processing..";
label34.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button9.BackColor = Color.Lime;
button12.BackColor = Color.Lime;
button22.BackColor = Color.Lime;
label13.Text = "Receive";
label13.ForeColor = System.Drawing.Color.Lime;
label20.Text = "Receive";
label20.ForeColor = System.Drawing.Color.Lime;
label34.Text = "Receive";
label34.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 10
label14.Text = "Processing..";
label14.ForeColor = System.Drawing.Color.Yellow;
label19.Text = "Processing..";
label19.ForeColor = System.Drawing.Color.Yellow;
label33.Text = "Processing..";
label33.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button10.BackColor = Color.Lime;
button11.BackColor = Color.Lime;
button21.BackColor = Color.Lime;
label14.Text = "Receive";
label14.ForeColor = System.Drawing.Color.Lime;
label19.Text = "Receive";
label19.ForeColor = System.Drawing.Color.Lime;
label33.Text = "Receive";
label33.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

msgrec();
}
else
{
if (rnno == 126)
{
tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;
tcalc = tend;
//Packet - 1
label1.Text = "Processing..";
label1.ForeColor = System.Drawing.Color.Yellow;
label28.Text = "Processing..";
label28.ForeColor = System.Drawing.Color.Yellow;
label42.Text = "Processing..";
label42.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button1.BackColor = Color.Lime;
button20.BackColor = Color.Lime;
button30.BackColor = Color.Lime;
label1.Text = "Receive";
label1.ForeColor = System.Drawing.Color.Lime;
label28.Text = "Receive";
label28.ForeColor = System.Drawing.Color.Lime;
label42.Text = "Receive";
label42.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 2
label4.Text = "Processing..";
label4.ForeColor = System.Drawing.Color.Yellow;
label27.Text = "Processing..";
label27.ForeColor = System.Drawing.Color.Yellow;
label41.Text = "Processing..";
label41.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button2.BackColor = Color.Lime;
button19.BackColor = Color.Lime;
button29.BackColor = Color.Lime;
label4.Text = "Receive";
label4.ForeColor = System.Drawing.Color.Lime;
label27.Text = "Receive";
label27.ForeColor = System.Drawing.Color.Lime;
label41.Text = "Receive";
label41.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 3
label5.Text = "Processing..";
label5.ForeColor = System.Drawing.Color.Yellow;
label26.Text = "Processing..";
label26.ForeColor = System.Drawing.Color.Yellow;
label40.Text = "Processing..";
label40.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button3.BackColor = Color.Lime;
button18.BackColor = Color.Lime;
button28.BackColor = Color.Lime;
label5.Text = "Receive";
label5.ForeColor = System.Drawing.Color.Lime;
label26.Text = "Receive";
label26.ForeColor = System.Drawing.Color.Lime;
label40.Text = "Receive";
label40.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 4
//Energy On Client - 2
label8.Text = "Processing..";
label8.ForeColor = System.Drawing.Color.Yellow;
label25.Text = "Processing..";
label25.ForeColor = System.Drawing.Color.Yellow;
label39.Text = "Processing..";
label39.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button4.BackColor = Color.Lime;
button17.BackColor = Color.Red;
button27.BackColor = Color.Lime;
label25.Text = "Delay";
label25.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label8.Text = "Receive";
label8.ForeColor = System.Drawing.Color.Lime;
label25.Text = "Energy";
label25.ForeColor = System.Drawing.Color.Yellow;
label39.Text = "Receive";
label39.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button17.BackColor = Color.Lime;
label25.Text = "Receive";
label25.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 5
label9.Text = "Processing..";
label9.ForeColor = System.Drawing.Color.Yellow;
label24.Text = "Processing..";
label24.ForeColor = System.Drawing.Color.Yellow;
label38.Text = "Processing..";
label38.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button5.BackColor = Color.Lime;
button16.BackColor = Color.Lime;
button26.BackColor = Color.Lime;
label9.Text = "Receive";
label9.ForeColor = System.Drawing.Color.Lime;
label24.Text = "Receive";
label24.ForeColor = System.Drawing.Color.Lime;
label38.Text = "Receive";
label38.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 6
//Energy On Client - 1
label10.Text = "Processing..";
label10.ForeColor = System.Drawing.Color.Yellow;
label23.Text = "Processing..";
label23.ForeColor = System.Drawing.Color.Yellow;
label37.Text = "Processing..";
label37.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button6.BackColor = Color.Red;
button15.BackColor = Color.Lime;
button25.BackColor = Color.Lime;
label10.Text = "Delay";
label10.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label10.Text = "Enrgy";
label10.ForeColor = System.Drawing.Color.Yellow;
label23.Text = "Receive";
label23.ForeColor = System.Drawing.Color.Lime;
label37.Text = "Receive";
label37.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button6.BackColor = Color.Lime;
label10.Text = "Receive";
label10.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 7
label11.Text = "Processing..";
label11.ForeColor = System.Drawing.Color.Yellow;
label22.Text = "Processing..";
label22.ForeColor = System.Drawing.Color.Yellow;
label36.Text = "Processing..";
label36.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button7.BackColor = Color.Lime;
button14.BackColor = Color.Lime;
button24.BackColor = Color.Lime;
label11.Text = "Receive";
label11.ForeColor = System.Drawing.Color.Lime;
label22.Text = "Receive";
label22.ForeColor = System.Drawing.Color.Lime;
label36.Text = "Receive";
label36.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 8
//Energy On Client - 2
label12.Text = "Processing..";
label12.ForeColor = System.Drawing.Color.Yellow;
label21.Text = "Processing..";
label21.ForeColor = System.Drawing.Color.Yellow;
label35.Text = "Processing..";
label35.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button8.BackColor = Color.Lime;
button13.BackColor = Color.Red;
button23.BackColor = Color.Lime;
label21.Text = "Delay";
label21.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label12.Text = "Receive";
label12.ForeColor = System.Drawing.Color.Lime;
label35.Text = "Receive";
label35.ForeColor = System.Drawing.Color.Lime;
label21.Text = "Energy";
label21.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button13.BackColor = Color.Lime;
label21.Text = "Receive";
label21.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 9
label13.Text = "Processing..";
label13.ForeColor = System.Drawing.Color.Yellow;
label20.Text = "Processing..";
label20.ForeColor = System.Drawing.Color.Yellow;
label34.Text = "Processing..";
label34.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button9.BackColor = Color.Lime;
button12.BackColor = Color.Lime;
button22.BackColor = Color.Lime;
label13.Text = "Receive";
label13.ForeColor = System.Drawing.Color.Lime;
label20.Text = "Receive";
label20.ForeColor = System.Drawing.Color.Lime;
label34.Text = "Receive";
label34.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) / 1000;


tcalc = tcalc + tend;
//Packet - 10
label14.Text = "Processing..";
label14.ForeColor = System.Drawing.Color.Yellow;
label19.Text = "Processing..";
label19.ForeColor = System.Drawing.Color.Yellow;
label33.Text = "Processing..";
label33.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button10.BackColor = Color.Lime;
button11.BackColor = Color.Lime;
button21.BackColor = Color.Lime;
label14.Text = "Receive";
label14.ForeColor = System.Drawing.Color.Lime;
label19.Text = "Receive";
label19.ForeColor = System.Drawing.Color.Lime;
label33.Text = "Receive";
label33.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

msgrec();
}
else
{
if (rnno == 127)
{
tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /
1000;
tcalc = tend;
//Packet - 1
label1.Text = "Processing..";
label1.ForeColor = System.Drawing.Color.Yellow;
label28.Text = "Processing..";
label28.ForeColor = System.Drawing.Color.Yellow;
label42.Text = "Processing..";
label42.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button1.BackColor = Color.Lime;
button20.BackColor = Color.Lime;
button30.BackColor = Color.Lime;
label1.Text = "Receive";
label1.ForeColor = System.Drawing.Color.Lime;
label28.Text = "Receive";
label28.ForeColor = System.Drawing.Color.Lime;
label42.Text = "Receive";
label42.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 2
label4.Text = "Processing..";
label4.ForeColor = System.Drawing.Color.Yellow;
label27.Text = "Processing..";
label27.ForeColor = System.Drawing.Color.Yellow;
label41.Text = "Processing..";
label41.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button2.BackColor = Color.Lime;
button19.BackColor = Color.Lime;
button29.BackColor = Color.Lime;
label4.Text = "Receive";
label4.ForeColor = System.Drawing.Color.Lime;
label27.Text = "Receive";
label27.ForeColor = System.Drawing.Color.Lime;
label41.Text = "Receive";
label41.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /
1000;
tcalc = tcalc + tend;
//Packet - 3
label5.Text = "Processing..";
label5.ForeColor = System.Drawing.Color.Yellow;
label26.Text = "Processing..";
label26.ForeColor = System.Drawing.Color.Yellow;
label40.Text = "Processing..";
label40.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button3.BackColor = Color.Lime;
button18.BackColor = Color.Lime;
button28.BackColor = Color.Lime;
label5.Text = "Receive";
label5.ForeColor = System.Drawing.Color.Lime;
label26.Text = "Receive";
label26.ForeColor = System.Drawing.Color.Lime;
label40.Text = "Receive";
label40.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 4
//Energy On Client - 2
label8.Text = "Processing..";
label8.ForeColor = System.Drawing.Color.Yellow;
label25.Text = "Processing..";
label25.ForeColor = System.Drawing.Color.Yellow;
label39.Text = "Processing..";
label39.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button4.BackColor = Color.Lime;
button17.BackColor = Color.Red;
button27.BackColor = Color.Lime;
label25.Text = "Delay";
label25.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label8.Text = "Receive";
label8.ForeColor = System.Drawing.Color.Lime;
label25.Text = "Energy";
label25.ForeColor = System.Drawing.Color.Yellow;
label39.Text = "Receive";
label39.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button17.BackColor = Color.Lime;
label25.Text = "Receive";
label25.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 5
label9.Text = "Processing..";
label9.ForeColor = System.Drawing.Color.Yellow;
label24.Text = "Processing..";
label24.ForeColor = System.Drawing.Color.Yellow;
label38.Text = "Processing..";
label38.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button5.BackColor = Color.Lime;
button16.BackColor = Color.Lime;
button26.BackColor = Color.Lime;
label9.Text = "Receive";
label9.ForeColor = System.Drawing.Color.Lime;
label24.Text = "Receive";
label24.ForeColor = System.Drawing.Color.Lime;
label38.Text = "Receive";
label38.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 6
//Energy On Client - 1
label10.Text = "Processing..";
label10.ForeColor = System.Drawing.Color.Yellow;
label23.Text = "Processing..";
label23.ForeColor = System.Drawing.Color.Yellow;
label37.Text = "Processing..";
label37.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button6.BackColor = Color.Red;
button15.BackColor = Color.Lime;
button25.BackColor = Color.Lime;
label10.Text = "Delay";
label10.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label10.Text = "Enrgy";
label10.ForeColor = System.Drawing.Color.Yellow;
label23.Text = "Receive";
label23.ForeColor = System.Drawing.Color.Lime;
label37.Text = "Receive";
label37.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button6.BackColor = Color.Lime;
label10.Text = "Receive";
label10.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 7
label11.Text = "Processing..";
label11.ForeColor = System.Drawing.Color.Yellow;
label22.Text = "Processing..";
label22.ForeColor = System.Drawing.Color.Yellow;
label36.Text = "Processing..";
label36.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button7.BackColor = Color.Lime;
button14.BackColor = Color.Lime;
button24.BackColor = Color.Lime;
label11.Text = "Receive";
label11.ForeColor = System.Drawing.Color.Lime;
label22.Text = "Receive";
label22.ForeColor = System.Drawing.Color.Lime;
label36.Text = "Receive";
label36.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 8
//Energy On Client - 3
label12.Text = "Processing..";
label12.ForeColor = System.Drawing.Color.Yellow;
label21.Text = "Processing..";
label21.ForeColor = System.Drawing.Color.Yellow;
label35.Text = "Processing..";
label35.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button8.BackColor = Color.Lime;
button13.BackColor = Color.Lime;
button23.BackColor = Color.Red;
label35.Text = "Delay";
label35.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label12.Text = "Receive";
label12.ForeColor = System.Drawing.Color.Lime;
label35.Text = "Energy";
label35.ForeColor = System.Drawing.Color.Yellow;
label21.Text = "Receive";
label21.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button23.BackColor = Color.Lime;
label35.Text = "Receive";
label35.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 9
label13.Text = "Processing..";
label13.ForeColor = System.Drawing.Color.Yellow;
label20.Text = "Processing..";
label20.ForeColor = System.Drawing.Color.Yellow;
label34.Text = "Processing..";
label34.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button9.BackColor = Color.Lime;
button12.BackColor = Color.Lime;
button22.BackColor = Color.Lime;
label13.Text = "Receive";
label13.ForeColor = System.Drawing.Color.Lime;
label20.Text = "Receive";
label20.ForeColor = System.Drawing.Color.Lime;
label34.Text = "Receive";
label34.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond) /


1000;
tcalc = tcalc + tend;
//Packet - 10
label14.Text = "Processing..";
label14.ForeColor = System.Drawing.Color.Yellow;
label19.Text = "Processing..";
label19.ForeColor = System.Drawing.Color.Yellow;
label33.Text = "Processing..";
label33.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button10.BackColor = Color.Lime;
button11.BackColor = Color.Lime;
button21.BackColor = Color.Lime;
label14.Text = "Receive";
label14.ForeColor = System.Drawing.Color.Lime;
label19.Text = "Receive";
label19.ForeColor = System.Drawing.Color.Lime;
label33.Text = "Receive";
label33.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

msgrec();
}
else
{
if (rnno == 128)
{
tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)
/ 1000;
tcalc = tend;
//Packet - 1
label1.Text = "Processing..";
label1.ForeColor = System.Drawing.Color.Yellow;
label28.Text = "Processing..";
label28.ForeColor = System.Drawing.Color.Yellow;
label42.Text = "Processing..";
label42.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button1.BackColor = Color.Lime;
button20.BackColor = Color.Lime;
button30.BackColor = Color.Lime;
label1.Text = "Receive";
label1.ForeColor = System.Drawing.Color.Lime;
label28.Text = "Receive";
label28.ForeColor = System.Drawing.Color.Lime;
label42.Text = "Receive";
label42.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 2
label4.Text = "Processing..";
label4.ForeColor = System.Drawing.Color.Yellow;
label27.Text = "Processing..";
label27.ForeColor = System.Drawing.Color.Yellow;
label41.Text = "Processing..";
label41.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button2.BackColor = Color.Lime;
button19.BackColor = Color.Lime;
button29.BackColor = Color.Lime;
label4.Text = "Receive";
label4.ForeColor = System.Drawing.Color.Lime;
label27.Text = "Receive";
label27.ForeColor = System.Drawing.Color.Lime;
label41.Text = "Receive";
label41.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 3
label5.Text = "Processing..";
label5.ForeColor = System.Drawing.Color.Yellow;
label26.Text = "Processing..";
label26.ForeColor = System.Drawing.Color.Yellow;
label40.Text = "Processing..";
label40.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button3.BackColor = Color.Lime;
button18.BackColor = Color.Lime;
button28.BackColor = Color.Lime;
label5.Text = "Receive";
label5.ForeColor = System.Drawing.Color.Lime;
label26.Text = "Receive";
label26.ForeColor = System.Drawing.Color.Lime;
label40.Text = "Receive";
label40.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 4
//Energy On Client - 3
label8.Text = "Processing..";
label8.ForeColor = System.Drawing.Color.Yellow;
label25.Text = "Processing..";
label25.ForeColor = System.Drawing.Color.Yellow;
label39.Text = "Processing..";
label39.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button4.BackColor = Color.Lime;
button17.BackColor = Color.Lime;
button27.BackColor = Color.Red;
label39.Text = "Delay";
label39.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label8.Text = "Receive";
label8.ForeColor = System.Drawing.Color.Lime;
label25.Text = "Receive";
label25.ForeColor = System.Drawing.Color.Lime;
label39.Text = "Energy";
label39.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button27.BackColor = Color.Lime;
label39.Text = "Receive";
label39.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 5
label9.Text = "Processing..";
label9.ForeColor = System.Drawing.Color.Yellow;
label24.Text = "Processing..";
label24.ForeColor = System.Drawing.Color.Yellow;
label38.Text = "Processing..";
label38.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button5.BackColor = Color.Lime;
button16.BackColor = Color.Lime;
button26.BackColor = Color.Lime;
label9.Text = "Receive";
label9.ForeColor = System.Drawing.Color.Lime;
label24.Text = "Receive";
label24.ForeColor = System.Drawing.Color.Lime;
label38.Text = "Receive";
label38.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 6
//Energy On Client - 1
label10.Text = "Processing..";
label10.ForeColor = System.Drawing.Color.Yellow;
label23.Text = "Processing..";
label23.ForeColor = System.Drawing.Color.Yellow;
label37.Text = "Processing..";
label37.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button6.BackColor = Color.Red;
button15.BackColor = Color.Lime;
button25.BackColor = Color.Lime;
label10.Text = "Delay";
label10.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label10.Text = "Enrgy";
label10.ForeColor = System.Drawing.Color.Yellow;
label23.Text = "Receive";
label23.ForeColor = System.Drawing.Color.Lime;
label37.Text = "Receive";
label37.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button6.BackColor = Color.Lime;
label10.Text = "Receive";
label10.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 7
label11.Text = "Processing..";
label11.ForeColor = System.Drawing.Color.Yellow;
label22.Text = "Processing..";
label22.ForeColor = System.Drawing.Color.Yellow;
label36.Text = "Processing..";
label36.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button7.BackColor = Color.Lime;
button14.BackColor = Color.Lime;
button24.BackColor = Color.Lime;
label11.Text = "Receive";
label11.ForeColor = System.Drawing.Color.Lime;
label22.Text = "Receive";
label22.ForeColor = System.Drawing.Color.Lime;
label36.Text = "Receive";
label36.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 8
//Energy On Client - 2
label12.Text = "Processing..";
label12.ForeColor = System.Drawing.Color.Yellow;
label21.Text = "Processing..";
label21.ForeColor = System.Drawing.Color.Yellow;
label35.Text = "Processing..";
label35.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button8.BackColor = Color.Lime;
button13.BackColor = Color.Red;
button23.BackColor = Color.Lime;
label21.Text = "Delay";
label21.ForeColor = System.Drawing.Color.Red;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label12.Text = "Receive";
label12.ForeColor = System.Drawing.Color.Lime;
label35.Text = "Receive";
label35.ForeColor = System.Drawing.Color.Lime;
label21.Text = "Energy";
label21.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
button13.BackColor = Color.Lime;
label21.Text = "Receive";
label21.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 9
label13.Text = "Processing..";
label13.ForeColor = System.Drawing.Color.Yellow;
label20.Text = "Processing..";
label20.ForeColor = System.Drawing.Color.Yellow;
label34.Text = "Processing..";
label34.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button9.BackColor = Color.Lime;
button12.BackColor = Color.Lime;
button22.BackColor = Color.Lime;
label13.Text = "Receive";
label13.ForeColor = System.Drawing.Color.Lime;
label20.Text = "Receive";
label20.ForeColor = System.Drawing.Color.Lime;
label34.Text = "Receive";
label34.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

tend = tstart - Convert.ToDouble(DateTime.Now.Millisecond)


/ 1000;
tcalc = tcalc + tend;
//Packet - 10
label14.Text = "Processing..";
label14.ForeColor = System.Drawing.Color.Yellow;
label19.Text = "Processing..";
label19.ForeColor = System.Drawing.Color.Yellow;
label33.Text = "Processing..";
label33.ForeColor = System.Drawing.Color.Yellow;
Application.DoEvents();
System.Threading.Thread.Sleep(2000);
button10.BackColor = Color.Lime;
button11.BackColor = Color.Lime;
button21.BackColor = Color.Lime;
label14.Text = "Receive";
label14.ForeColor = System.Drawing.Color.Lime;
label19.Text = "Receive";
label19.ForeColor = System.Drawing.Color.Lime;
label33.Text = "Receive";
label33.ForeColor = System.Drawing.Color.Lime;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);

msgrec();
}
}
}
}
}

public void msgrec()


{
DialogResult dlgResult = MessageBox.Show(totalbytes, "File's Receive
Success !", MessageBoxButtons.OK, MessageBoxIcon.Information);

if (dlgResult == DialogResult.OK)
{
filenames = "File Name : " + filename1 + "\n\n" + "File Name : " +
filename2 + "\n\n" + "File Name : " + filename3 + "\n\n";
groupBox5.Text = "filename : "+ filename1;
groupBox2.Text = "filename : " + filename2;
groupBox6.Text = "filename : " + filename3;

//pictureBox2.Enabled = true;
pictureBox1.Enabled = true;
//pictureBox3.Enabled = true;
pictureBox4.Enabled = true;
//pictureBox5.Enabled = true;
pictureBox6.Enabled = true;

MessageBox.Show(filenames, "Received File's !", MessageBoxButtons.OK,


MessageBoxIcon.Information);
}
}

private void pictureBox1_Click(object sender, EventArgs e)


{
pictureBox4.Enabled = false;
pictureBox6.Enabled = false;
pictureBox2.Visible = true;
label46.Visible = true;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label46.Text = "loading..";
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label46.Text = "loading...";
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label46.Text = "Stop";
Application.DoEvents();
System.Threading.Thread.Sleep(500);
FileDownload fd = new FileDownload(username1,filesize1,filename1);
fd.ShowDialog();
pictureBox4.Enabled = true;
pictureBox6.Enabled = true;
}

private void pictureBox4_Click(object sender, EventArgs e)


{
pictureBox1.Enabled = false;
pictureBox6.Enabled = false;
pictureBox3.Visible = true;
label47.Visible = true;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label47.Text = "loading..";
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label47.Text = "loading...";
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label47.Text = "Stop";
Application.DoEvents();
System.Threading.Thread.Sleep(500);
FileDownload fd = new FileDownload(username2, filesize2, filename2);
fd.ShowDialog();
pictureBox1.Enabled = true;
pictureBox6.Enabled = true;
}

private void pictureBox6_Click(object sender, EventArgs e)


{
pictureBox1.Enabled = false;
pictureBox4.Enabled = false;
pictureBox5.Visible = true;
label48.Visible = true;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label48.Text = "loading..";
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label48.Text = "loading...";
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
label48.Text = "Stop";
Application.DoEvents();
System.Threading.Thread.Sleep(500);
FileDownload fd = new FileDownload(username3, filesize3, filename3);
fd.ShowDialog();
pictureBox1.Enabled = true;
pictureBox4.Enabled = true;
}

private void groupBox5_Enter(object sender, EventArgs e)


{

private void groupBox7_Enter(object sender, EventArgs e)


{

}
}

class Clients
{
IPEndPoint ipEnd;
Socket sock;
public Clients()
{
string hostName = Dns.GetHostName();
// IPHostEntry ipEntry = Dns.GetHostEntry(Environment.MachineName);
IPAddress IpAddr = Dns.GetHostByName(hostName).AddressList[0];
ipEnd = new IPEndPoint(IpAddr, 5658);
sock = new Socket(ipEnd.AddressFamily, SocketType.Stream,
ProtocolType.IP);
sock.Bind(ipEnd);

/*
IPHostEntry ipEntry = Dns.GetHostEntry(Environment.MachineName);
IPAddress IpAddr = ipEntry.AddressList[0];
ipEnd = new IPEndPoint(IpAddr, 5659);
sock = new Socket(ipEnd.AddressFamily, SocketType.Stream,
ProtocolType.IP);
sock.Bind(ipEnd);

*/

/*
IPHostEntry ipEntry = Dns.GetHostEntry(Environment.MachineName);
IPAddress IpAddr = ipEntry.AddressList[0];
ipEnd = new IPEndPoint(IpAddr, 5656);
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.IP);
sock.Bind(ipEnd);*/
}
public static string receivedPath;
public static string Rout= "";
public static string curMsg = "Stopped";
public void StartServer()
{
try
{
//curMsg = "Starting...";
sock.Listen(100);
// curMsg = "Running and waiting to receive file.";
Socket clientSock = sock.Accept();
Rout = "Start";
System.Threading.Thread.Sleep(4000);
}
catch (Exception ex)
{
curMsg = "File Receving error.";
}
}
}
}

Admin Login:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace SourceMain
{
public partial class Form1 : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
int totreqcount;
string rproceedstatus = "Proceed", empty = "";

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'adaptiveFaultDataSet1.Register' table. You can move, or remove it, as needed.
this.registerTableAdapter.Fill(this.adaptiveFaultDataSet1.Register);
ToolTip toolTip1 = new ToolTip();

toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 500;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
// toolTip1.SetToolTip(this.pictureBox7, "Click To Reload");
toolTip1.SetToolTip(this.pictureBox1, "Click To Admin Login");
toolTip1.SetToolTip(this.label3, "Click To Admin Login");
toolTip1.SetToolTip(this.pictureBox2, "Click To Upload Files");
toolTip1.SetToolTip(this.label4, "Click To Upload Files");
toolTip1.SetToolTip(this.pictureBox8, "Click To Verify Requested Files");
toolTip1.SetToolTip(this.label9, "Click To Verify Requested Files");
toolTip1.SetToolTip(this.pictureBox3, "Click To Start Transaction");
toolTip1.SetToolTip(this.label5, "Click To File Start Transaction");

SqlConnection con = new SqlConnection(constring);


con.Open();
SqlCommand cmd = new SqlCommand("Delete From FileUpload", con);
cmd.ExecuteNonQuery();
con.Close();

groupBox1.Visible = false;
pictureBox2.Enabled = false;
label4.Enabled = false;
//pictureBox3.Enabled = false;
// label11.Enabled = true;
pictureBox8.Enabled = false;
label9.Enabled = false;
pictureBox3.Enabled = false;
label5.Enabled = false;
}

private void pictureBox1_Click(object sender, EventArgs e)


{
// pictureBox4.Visible = false;
//pictureBox11.Visible = false;
groupBox1.Visible = true;
// label11.Visible = false;
}

private void label3_Click(object sender, EventArgs e)


{
// pictureBox4.Visible = false;
// label11.Visible = false;
groupBox1.Visible = true;
}
private void pictureBox7_Click(object sender, EventArgs e)
{
pictureBox1.Enabled = true;
label3.Enabled = true;
// pictureBox4.Visible = true;
// label11.Visible = true;
groupBox1.Visible = false;
pictureBox2.Enabled = false;
label4.Enabled = false;
pictureBox3.Enabled = false;
label5.Enabled = false;
pictureBox8.Enabled = false;
label9.Enabled = false;
}

private void button2_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
}

private void button1_Click(object sender, EventArgs e)


{
string txt1 = textBox1.Text.ToUpper();
string txt2 = textBox2.Text.ToUpper();

if (txt1 == "ADMIN" && txt2 == "ADMIN")


{
groupBox1.Visible = false;
pictureBox1.Enabled = false;
label3.Enabled = false;
pictureBox2.Enabled = true;
label4.Enabled = true;
pictureBox3.Enabled = true;
label5.Enabled = true;
pictureBox8.Enabled = true;
label9.Enabled = true;
pictureBox9.Enabled = true;
label10.Enabled = true;
pictureBox3.Enabled = true;
label5.Enabled = true;
}
else
{

}
textBox1.Text = "";
textBox2.Text = "";
}

private void pictureBox2_Click(object sender, EventArgs e)


{
FileUpload fu = new FileUpload();
fu.ShowDialog();
}

private void label4_Click(object sender, EventArgs e)


{
FileUpload fu = new FileUpload();
fu.ShowDialog();
}
private void pictureBox8_Click(object sender, EventArgs e)
{
Transaction tr = new Transaction();
tr.ShowDialog();
}

private void label9_Click(object sender, EventArgs e)


{
Transaction tr = new Transaction();
tr.ShowDialog();
}

private void pictureBox3_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();

SqlDataAdapter adp1 = new SqlDataAdapter("Select COUNT(rstatus) as


reqstatus from FileUpload where rstatus='" + rproceedstatus + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
totreqcount =
Convert.ToInt32(ds1.Tables[0].Rows[0]["reqstatus"].ToString());
if (totreqcount == 3)
{
//START TRANSACTION
Transaction tr = new Transaction();
tr.ShowDialog();
}
else
{
MessageBox.Show("ERROR - DO NOT PROCEED FILES.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

con.Close();
}

private void label5_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();

SqlDataAdapter adp1 = new SqlDataAdapter("Select COUNT(rstatus) as


reqstatus from FileUpload where rstatus='" + rproceedstatus + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
totreqcount =
Convert.ToInt32(ds1.Tables[0].Rows[0]["reqstatus"].ToString());
if (totreqcount == 3)
{
//START TRANSACTION
Transaction tr = new Transaction();
tr.ShowDialog();
}
else
{
MessageBox.Show("ERROR - DO NOT PROCEED FILES.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}

con.Close();
}

private void pictureBox9_Click(object sender, EventArgs e)


{
RequestFiles rf = new RequestFiles();
rf.ShowDialog();
}

private void label10_Click(object sender, EventArgs e)


{
RequestFiles rf = new RequestFiles();
rf.ShowDialog();
}

private void pictureBox5_Click(object sender, EventArgs e)


{

private void pictureBox4_Click(object sender, EventArgs e)


{

private void pictureBox10_Click(object sender, EventArgs e)


{
Form2 fu = new Form2();
fu.ShowDialog();
}

private void pictureBox6_Click(object sender, EventArgs e)


{

private void label11_Click(object sender, EventArgs e)


{
// label11.Visible = true;
//pictureBox2.Enabled = false;
}

private void label1_Click(object sender, EventArgs e)


{

private void groupBox1_Enter(object sender, EventArgs e)


{

private void label6_Click(object sender, EventArgs e)


{

//private void button3_Click(object sender, EventArgs e)


//{
// Form2 frm2 = new Form2();
// frm2.ShowDialog();
//}
}
}

File Upload:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;

namespace SourceMain
{
public partial class FileUpload : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
Class1 cs = new Class1();
string fileDes, fileini, empty = "", rstatus = "Start";
int len;
string yes, yes1, yes2;

public FileUpload()
{
InitializeComponent();
}

private void FileUpload_Load(object sender, EventArgs e)


{
//textBox1.Text = Convert.ToString(cs.fileidgeneration());
}

private void btnbrowse_Click(object sender, EventArgs e)


{
textBox2.Text = "";
openFileDialog1.ShowDialog();
fileDes = openFileDialog1.FileName;

if (fileDes == "openFileDialog1")
{
//lblError.Text = "";
//lblError.Text = "Select a File first";
MessageBox.Show("Select any one File.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox2.Text = "";
button1.Enabled = false;
yes = null;
}
else
{
yes = "yes";
textBox2.Text = openFileDialog1.FileName;
len = fileDes.Length;
fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1);
button1.Enabled = true;

FileInfo fi = new FileInfo(openFileDialog1.FileName);


//byte[] data = new byte[fi.Length];
DateTime dt = fi.CreationTime;
FileStream fs = fi.Open(FileMode.Open, FileAccess.Read,
FileShare.Read);
//fs.Position = 0;
//fs.Read(data, 0, Convert.ToInt32(fi.Length));
label2.Text = fi.Name;
label3.Text = Convert.ToString(fi.Length) + " bytes";
label5.Text = Path.GetExtension(openFileDialog1.FileName);
}
}

private void button3_Click(object sender, EventArgs e)


{
textBox3.Text = "";
openFileDialog2.ShowDialog();
fileDes = openFileDialog2.FileName;

if (fileDes == "openFileDialog2")
{
//lblError.Text = "";
//lblError.Text = "Select a File first";
MessageBox.Show("Select any one File.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox3.Text = "";
button1.Enabled = false;
yes1 = null;
}
else
{
yes1 = "yes";
textBox3.Text = openFileDialog2.FileName;
len = fileDes.Length;
fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1);
button1.Enabled = true;

FileInfo fi = new FileInfo(openFileDialog2.FileName);


//byte[] data = new byte[fi.Length];
DateTime dt = fi.CreationTime;
FileStream fs = fi.Open(FileMode.Open, FileAccess.Read,
FileShare.Read);
//fs.Position = 0;
//fs.Read(data, 0, Convert.ToInt32(fi.Length));
label16.Text = fi.Name;
label13.Text = Convert.ToString(fi.Length) + " bytes";
label10.Text = Path.GetExtension(openFileDialog2.FileName);
}
}

private void button4_Click(object sender, EventArgs e)


{
textBox5.Text = "";
openFileDialog3.ShowDialog();
fileDes = openFileDialog3.FileName;

if (fileDes == "openFileDialog1")
{
//lblError.Text = "";
//lblError.Text = "Select a File first";
MessageBox.Show("Select any one File.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox5.Text = "";
button1.Enabled = false;
yes2 = null;
}
else
{
yes2 = "yes";
textBox5.Text = openFileDialog3.FileName;
len = fileDes.Length;
fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1);
button1.Enabled = true;

FileInfo fi = new FileInfo(openFileDialog3.FileName);


//byte[] data = new byte[fi.Length];
DateTime dt = fi.CreationTime;
FileStream fs = fi.Open(FileMode.Open, FileAccess.Read,
FileShare.Read);
fs.Position = 0;
//fs.Read(data, 0, Convert.ToInt32(fi.Length));
label24.Text = fi.Name;
label21.Text = Convert.ToString(fi.Length) + " bytes";
label18.Text = Path.GetExtension(openFileDialog3.FileName);
}
}

private void button1_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

SqlDataAdapter adp1 = new SqlDataAdapter("Select * from FileUpload", con);


DataSet ds1 = new DataSet();
adp1.Fill(ds1);
if (ds1.Tables[0].Rows.Count != 3)
{
if (yes == "yes" && yes1 == "yes" && yes2 == "yes")
{
FileInfo sfi = new FileInfo(openFileDialog1.FileName);
byte[] sdata = new byte[sfi.Length];
DateTime sdt = sfi.CreationTime;
FileStream sfs = sfi.Open(FileMode.Open, FileAccess.Read,
FileShare.Read);
sfs.Position = 0;
sfs.Read(sdata, 0, Convert.ToInt32(sfi.Length));
string filename = sfi.Name;
string filesize = Convert.ToString(sfi.Length);

FileInfo sfi1 = new FileInfo(openFileDialog2.FileName);


byte[] sdata1 = new byte[sfi1.Length];
DateTime sdt1 = sfi1.CreationTime;
FileStream sfs1 = sfi1.Open(FileMode.Open, FileAccess.Read,
FileShare.Read);
sfs1.Position = 0;
sfs1.Read(sdata1, 0, Convert.ToInt32(sfi1.Length));
string filename1 = sfi1.Name;
string filesize1 = Convert.ToString(sfi1.Length);

FileInfo sfi2 = new FileInfo(openFileDialog3.FileName);


byte[] sdata2 = new byte[sfi2.Length];
DateTime sdt2 = sfi2.CreationTime;
FileStream sfs2 = sfi2.Open(FileMode.Open, FileAccess.Read,
FileShare.Read);
sfs2.Position = 0;
sfs2.Read(sdata2, 0, Convert.ToInt32(sfi2.Length));
string filename2 = sfi2.Name;
string filesize2 = Convert.ToString(sfi2.Length);

con.Open();

SqlCommand cmd = new SqlCommand("insert into FileUpload values('"


+ textBox1.Text + "','" + textBox2.Text + "','" + label2.Text + "','" + filesize +
"','" + label5.Text + "',@files1,'" + empty + "','" + empty + "')", con);
cmd.Parameters.AddWithValue("@files1", sdata);
cmd.ExecuteNonQuery();

SqlCommand cmd1 = new SqlCommand("insert into FileUpload values('"


+ textBox4.Text + "','" + textBox3.Text + "','" + label16.Text + "','" + filesize1 +
"','" + label10.Text + "',@files2,'" + empty + "','" + empty + "')", con);
cmd1.Parameters.AddWithValue("@files2", sdata1);
cmd1.ExecuteNonQuery();

SqlCommand cmd2 = new SqlCommand("insert into FileUpload values('"


+ textBox6.Text + "','" + textBox5.Text + "','" + label24.Text + "','" + filesize2 +
"','" + label18.Text + "',@files3,'" + empty + "','" + empty + "')", con);
cmd2.Parameters.AddWithValue("@files3", sdata2);
cmd2.ExecuteNonQuery();

SqlCommand cmd3 = new SqlCommand("update FileUpload set rstatus='"


+ rstatus + "'", con);
cmd3.ExecuteNonQuery();

textBox2.Text = "";
label2.Text = "....................";
label3.Text = "....................";
label5.Text = "....................";
textBox3.Text = "";
label16.Text = "....................";
label13.Text = "....................";
label10.Text = "....................";
textBox5.Text = "";
label24.Text = "....................";
label21.Text = "....................";
label18.Text = "....................";

button1.Enabled = false;

System.Threading.Thread.Sleep(1000);

Transaction tr = new Transaction();


tr.ShowDialog();
}
else
{
MessageBox.Show("UPLOAD REMAINING FILES..", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
else
{
MessageBox.Show("WARNING : STACK IS FULL..", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

//public void uploadfile(string fi, string finam, byte[] fibytes, string exe,
string path1)
//{
// SqlConnection con2 = new SqlConnection(constring);
// con2.Open();
// int n = finam.Length;
// cmd2 = new SqlCommand("insert into FileUpload values('" + fi + "','" +
finam + "',@files,'" + exe + "','" + path1 + "')", con2);
// cmd2.Parameters.AddWithValue("@files", fibytes);
// cmd2.ExecuteNonQuery();
// con2.Close();
//}

private void btnreload_Click(object sender, EventArgs e)


{
yes2 = null;
yes1 = null;
yes = null;
textBox2.Text = "";
label2.Text = "....................";
label3.Text = "....................";
label5.Text = "....................";
textBox3.Text = "";
label16.Text = "....................";
label13.Text = "....................";
label10.Text = "....................";
textBox5.Text = "";
label24.Text = "....................";
label21.Text = "....................";
label18.Text = "....................";
button1.Enabled = false;
}

private void button2_Click(object sender, EventArgs e)


{
viewuploadfiles vuf = new viewuploadfiles();
vuf.ShowDialog();
}

}
}

File Request view:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;
namespace SourceMain
{
public partial class RequestFiles : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
string rstatus = "Receive", reqstatus, reqproceed = "Proceed";
int count = 0, count1 = 0;

public RequestFiles()
{
InitializeComponent();
}

private void RequestFiles_Load(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();

SqlDataAdapter adp2 = new SqlDataAdapter("Select * from FileUpload where


rstatus='" + reqproceed + "'", con);
DataSet ds2 = new DataSet();
adp2.Fill(ds2);
if (ds2.Tables[0].Rows.Count != 0)
{
btnproceed.Enabled = false;
SqlDataAdapter adp3 = new SqlDataAdapter("Select * from FileUpload",
con);
DataSet ds3 = new DataSet();
adp3.Fill(ds3);
for (int i = 0; i < ds3.Tables[0].Rows.Count; i++)
{
reqstatus = ds3.Tables[0].Rows[i]["rstatus"].ToString();
if (reqstatus == "Proceed")
{
count++;
if (count == 1)
{
label4.Text =
ds3.Tables[0].Rows[i]["ufilename"].ToString();
label5.Text =
ds3.Tables[0].Rows[i]["rusername"].ToString();
button2.Enabled = false;
pictureBox1.Visible = true;
}
else
{
if (count == 2)
{
label9.Text =
ds3.Tables[0].Rows[i]["ufilename"].ToString();
label8.Text =
ds3.Tables[0].Rows[i]["rusername"].ToString();
button3.Enabled = false;
pictureBox2.Visible = true;
}
else
{
if (count == 3)
{
label15.Text =
ds3.Tables[0].Rows[i]["ufilename"].ToString();
label14.Text =
ds3.Tables[0].Rows[i]["rusername"].ToString();
button4.Enabled = false;
pictureBox3.Visible = true;
}
}
}
}
else
{

}
}
MessageBox.Show("FILES ARE ALREADY PROCEED.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
SqlDataAdapter adp1 = new SqlDataAdapter("Select * from FileUpload
where rstatus='" + rstatus + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
if (ds1.Tables[0].Rows.Count == 0)
{
label4.Text = "---------------";
label5.Text = "---------------";
label8.Text = "---------------";
label9.Text = "---------------";
label14.Text = "---------------";
label15.Text = "---------------";
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
}
else
{
SqlDataAdapter adp = new SqlDataAdapter("Select * from
FileUpload", con);
DataSet ds = new DataSet();
adp.Fill(ds);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
reqstatus = ds.Tables[0].Rows[i]["rstatus"].ToString();
if (reqstatus == "Receive")
{
count++;
if (count == 1)
{
label4.Text =
ds.Tables[0].Rows[i]["ufilename"].ToString();
label5.Text =
ds.Tables[0].Rows[i]["rusername"].ToString();
button2.Enabled = true;
}
else
{
if (count == 2)
{
label9.Text =
ds.Tables[0].Rows[i]["ufilename"].ToString();
label8.Text =
ds.Tables[0].Rows[i]["rusername"].ToString();
button3.Enabled = true;
}
else
{
if (count == 3)
{
label15.Text =
ds.Tables[0].Rows[i]["ufilename"].ToString();
label14.Text =
ds.Tables[0].Rows[i]["rusername"].ToString();
button4.Enabled = true;
}
}
}

}
else
{

}
}
}
}
con.Close();
}

private void button2_Click(object sender, EventArgs e)


{
System.Threading.Thread.Sleep(1000);
pictureBox1.Visible = true;
button2.Enabled = false;
count1++;
}

private void button3_Click(object sender, EventArgs e)


{
System.Threading.Thread.Sleep(1000);
pictureBox2.Visible = true;
button3.Enabled = false;
count1++;
}

private void button4_Click(object sender, EventArgs e)


{
System.Threading.Thread.Sleep(1000);
pictureBox3.Visible = true;
button4.Enabled = false;
count1++;
}

private void btnproceed_Click(object sender, EventArgs e)


{
if (count1 == 3)
{
SqlConnection con = new SqlConnection(constring);
con.Open();
SqlCommand cmd = new SqlCommand("update FileUpload set rstatus='" +
reqproceed + "'where rstatus='" + rstatus + "'", con);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("FILES ARE PROCEED.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Information);
btnproceed.Enabled = false;
}
else
{
MessageBox.Show("ERROR - FILE VERIFICATION MISSING.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

private void label1_Click(object sender, EventArgs e)


{

private void pictureBox6_Click(object sender, EventArgs e)


{

}
}

File Download:
#define LaunchAsynch
#define KillFileAfterLaunch
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;
using System.Net;
using System.Diagnostics;

namespace Clients
{
public partial class FileDownload : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);
string fullpath;
private Process Launcher = null;
private string LaunchedFile = "";
int len;
string fileDes, fileini;

//string receivedPath;
//byte[] data1;
//byte[] data2;
//byte[] data3;
//byte[] data4;
//byte[] data5;
//byte[] data6;
//byte[] data7;
//byte[] data8;
//byte[] data9;
//byte[] data10;
//byte[] write;
//int fsize1, fsize2, fsize3, fsize4, fsize5, fsize6, fsize7, fsize8, fsize9,
fsize10;

public FileDownload(string username, double filesize, string filename)


{
InitializeComponent();
label2.Text = filename;
label7.Text = username;
label8.Text = Convert.ToString(filesize);
}

private void FileDownload_Load(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);

con.Open();

if (label7.Text == textBox2.Text)
{
SqlDataAdapter adp = new SqlDataAdapter("SELECT * FROM Register WHERE
loginid='" + textBox2.Text + "' and upassword='" + textBox1.Text + "'", con);
DataSet ds = new DataSet();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
{
MessageBox.Show("ERROR - CLIENT NOT AUTHORIZED.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
SqlDataAdapter adp1 = new SqlDataAdapter("SELECT * FROM FileUpload
WHERE ufilename='" + label2.Text + "' and rusername='" + label7.Text + "' and
ufilesize='" + label8.Text + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
label10.Text = ds1.Tables[0].Rows[0]["ufileext"].ToString();

groupBox5.Visible = false;
groupBox1.Visible = true;
}
con.Close();
}
else
{
MessageBox.Show("ERROR - CLIENT NOT AUTHORIZED.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

private void pictureBox1_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(constring);
con.Open();

SqlDataAdapter adp1 = new SqlDataAdapter("SELECT * FROM FileUpload WHERE


ufilename='" + label2.Text + "' and rusername='" + label7.Text + "' and ufilesize='" +
label8.Text + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
if (ds1.Tables[0].Rows.Count == 0)
{
MessageBox.Show("FILE DOWNLOAD ERROR.", "Message Box",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
fullpath = ds1.Tables[0].Rows[0]["ufilepath"].ToString();
con.Close();
download();
label12.Visible = true;
}
}

private void Launcher_Exited(object sender, EventArgs e)


{
Launcher.Dispose();
Launcher = null;
#if KillFileAfterLaunch
if (File.Exists(LaunchedFile))
File.Delete(LaunchedFile);
#endif
}

//private void btnbrowse_Click(object sender, EventArgs e)


//{
// FolderBrowserDialog f = new FolderBrowserDialog();
// f.ShowDialog();
// if (f.SelectedPath != "")
// {
// Clients.receivedPath = f.SelectedPath;
// label14.Text = f.SelectedPath;
// label13.Text = "path selected";
// System.Threading.Thread.Sleep(1000);
// pictureBox1.Visible = true;
// //openFileDialog1.ShowDialog();
// //fileDes = openFileDialog1.FileName;
// //len = fileDes.Length;
// //fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1);
// }
// else
// {
// label13.Text = "path not selected";
// }
//}

public void download()


{
SqlConnection con = new SqlConnection(constring);

con.Open();
SqlDataAdapter adp1 = new SqlDataAdapter("SELECT * FROM FileUpload WHERE
ufilename='" + label2.Text + "' and rusername='" + label7.Text + "' and ufilesize='" +
label8.Text + "'", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1);

//string recpath =
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string recpath = Path.GetTempPath();
//string recpath = label14.Text;

//DataRow row = ds1.Tables[0].Rows[ds1.Position]; // If you go sorting


the columns, you may need to change this
DataRow row = ds1.Tables[0].Rows[0]; // If you go sorting the columns,
you may need to change this
LaunchedFile = recpath + "\\" + (string)row["ufilename"]; // Get
our new Filename and pat
FileInfo fi = new FileInfo(LaunchedFile); // Get our
hands around the file specification
FileStream fs = fi.Create(); // Create
the new file
byte[] Data = new byte[0]; //
Instantiate a buffer to hold the data
Data = (byte[])row["ufiledata"]; // Load the buffer
int ArraySize = new int(); // Find
the Size of the buffer (aka file)
ArraySize = Data.GetUpperBound(0);
fs.Write(Data, 0, ArraySize); //
Write the file to disk. If a really large file, then braek it up
fs.Flush(); // Flush
the bytes to the disk
fs.Close();

//MessageBox.Show("FILE DOWNLOAD SUCCESS.", "Message Box",


MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
//label13.Text = "file received";

#if !KillFileAfterLaunch

File.SetCreationTime(LaunchedFile,
(DateTime)row["FileDateTime"]);
File.SetLastWriteTime(LaunchedFile,
(DateTime)row["FileDateTime"]);
File.SetLastAccessTime(LaunchedFile,
(DateTime)row["FileDateTime"]);
#endif

Launcher = new Process(); // Fire


up a process
Launcher.StartInfo.FileName = fi.FullName; // Give
it the name of our file we just created
Launcher.StartInfo.WorkingDirectory = recpath; // Tell
it to work in the temp directory

//If you want your program to wait, then use this approach
#if LaunchAsynch
Launcher.Exited += new EventHandler(Launcher_Exited); // Let us
know when the user closed the surrogate application
Launcher.EnableRaisingEvents = true; // Only works
if we allow it to raise events
Launcher.Start(); // Fire this
puppy up (aka launch the file)
#else
Launcher.Start();
Launcher.WaitForExit(); //
optionally Just wait here until it is done
Launcher.Dispose(); // Clean
up
Launcher = null;
If you want to delete the file after
#if KillFileAfterLaunch
if(File.Exists(LaunchedFile))
File.Delete(LaunchedFile);
#endif
#endif
}

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{
//Third Method..
}

}
}

View Upload files:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace SourceMain
{
public partial class viewuploadfiles : Form
{
string constring =
Convert.ToString(ConfigurationSettings.AppSettings["ConnectionString"]);

public viewuploadfiles()
{
InitializeComponent();
}

private void viewuploadfiles_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'adaptiveFaultDataSet.FileUpload' table. You can move, or remove it, as needed.
this.fileUploadTableAdapter.Fill(this.adaptiveFaultDataSet.FileUpload);
//SqlConnection con = new SqlConnection(constring);
//con.Open();
//SqlDataAdapter da = new SqlDataAdapter("Select
id,ufilename,ufilesize,ufileext from FileUpload", con);
//DataSet ds = new DataSet();
//BindingSource bsourse = new BindingSource();
//SqlCommandBuilder cmd = new SqlCommandBuilder(da);
//da.Fill(ds, "FileUpload");
////ds.Tables[0].Constraints.Add("CReqTo", ds.Tables[0].Columns[0], true);
//bsourse.DataSource = ds.Tables["FileUpload"];
//dataGridView1.DataSource = bsourse;
//dataGridView1.Visible = true;
//con.Close();
}

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

}
}
}
SCREEN SHOTS
Register:

LOGIN:
UPLOAD FILES:

TRANSACTION FORM:
FILE REQUEST:

TRANSACTION FORM:

VERIFY FILES:
CLIENT TRANSACTION:

DOWNLOAD THE UPLOADED FILES:


VIEW UPLOADED FILES:
CHAPTER 13

CONCLUSION

In this paper, we have considered the problem of finding opti-mal


mobile data gathering strategies for energy harvesting sensor
networks. We first examine the impact of spatial-temporally varying
energy distribution on the operation of the sensor network through an
experimental study based on solar harvesting. To circumvent the
negative effect of limited energy harvesting capability on some sensor
nodes, a mobile collector is introduced for gathering data and
balancing energy distribution in the network to improve performance.
We then propose an adaptive anchor selection algorithm based on
sensors energy level which achieves a desirable balance between the
amount of data gathered and data gathering latency. We then
formulate the problem into a convex optimization problem in which
the SenCar spends variable sojourn time at each anchor and each
sensor tunes the data rate, scheduling and routing based on the
individual energy harvesting rate such that the overall network utility
can be maximized.
REFERENCES

[1] M. Rahimi, H. Shah, G. Sukhatme, J. Heideman and D. Estrin,


Studying the feasibility of energy harvesting in a mobile sensor
network, IEEE International Conference on Robotics and
Automation, 2003.
[2] J. Paradiso, T. Starner, Energy scanverging for mobile and
wireless electronics, IEEE Journal of Pervasive Computing, vol. 4,
no. 1, pp. 18-27, 2005.
[3] X. Jiang, J. Polastre, and D. Culler, Perpetual environmentally
powered sensor networks, IEEE IPSN Apr. 2005.
[4] V. Raghunathan, A. Kansal, J. Hsu, J. Friedman, and M.
Srivastava, Design considerations for solar energy harvesting
wireless embedded systems, IEEE IPSN Apr. 2005.
[5] C. Ma, Z. Zhang and Y. Yang, Battery-aware scheduling in
wireless mesh networks, Mobile Networks and Applications, vol. 13,
no. 1-2, pp. 228-241, 2008.
[6] C. Ma and Y. Yang, Battery-aware routing for streaming data
transmissions in wireless sensor networks, Mobile Networks and
Applications, vol. 11, no. 5, pp. 757-767, 2006.
[7] A. Kansal, J. Hsu, M. Srivastava and V. Raqhunathan,
Harvesting aware power management for sensor networks, 43rd
ACM/IEEE DAC, 2006.
[8] C. Ma and Y. Yang, A battery-aware scheme for routing in
wireless ad hoc networks, IEEE Trans. TVT, vol. 60, no. 8, pp.
3919-3932, 2011.
[9] C. Vigorito, D. Ganesan and A. Barto, Adaptove control of duty
cycling in energy-harvesting wireless sensor networks, IEEE
SECON, 2007.
[10] M. Gorlatova, A. Wallwater, G. Zussman, Networking low-
power energy harvesting devices: measurements and algorithms,
IEEE INFOCOM, 2011.
[11] R. Liu, P. Sinha and C. E. Koksal, Joint energy management
and resource allocation in rechargeable sensor networks, IEEE
INFOCOM, 2010.
[12] L. Lin, N. Shroff, R. Srikant, Asymptotically optimal energy-
aware routing for multihop wireless networks with renewable energy
sources networking, IEEE/ACM Trans. Networking, vol. 15, no. 5,
pp. 1021-1034, 2007.
[13] R.C. Shah, J.M Rabaey, Energy aware routing for low energy
ad hoc sensor networks, IEEE WCNC 2002.
[14] M. Ma and Y. Yang,SenCar: An energy efficient data gathering
mechanism for large scale multihop sensor networks, IEEE Trans.
TPDS, vol.18, no.10, pp.1476-1488, 2007.
[15] M. Ma, Y. Yang and M. Zhao, Tour planning for mobile data
gathering mechanisms in wireless sensor networks, IEEE Trans.
TVT, vol. 62, no. 4, pp. 1472-1483, 2013.

You might also like