You are on page 1of 71

CELL BREATHING TECHNIQUE FOR LOAD BALANCING IN WLAN

A PROJECT REPORT SUBMITTED IN FULFILLMENT OF THE REQUIREMENT FOR THE AWARD OF THE DEGREE OF BACHELOR OF TECHNOLOGY IN INFORMATION TECHNOLOGY
TO

Gautam Budha Technical University

SUBMITTED BY
PRERNA CHAUDHARY- 0906813059 VISHAL SINGH- 0906813082

DEPARTMENT OF INFORMATION TECHNOLOGY MEERUT INSTITUTE OF ENGINEERING & TECHNOLOGY, BYPASS ROAD, MEERUT-250006, INDIA May, 2013

CERTIFICATE

This is to certify that this thesis report titled, Cell Breathing Technique for Load Balancing in WLAN, submitted by Prerna Chaudhary , Vishal Singh in partial fulllment of the requirement for the award of Bachelor of Technology (Information Technology) degree, Gautam Budha University, Lucknow, India is a record of students own study carried under my supervision and guidance. The project report has not been submitted to any other university or institution for the award of any degree.

Guide

Dr.Nitin Goyal Asst. Professor, Dept. of IT

ACKNOWLEDGEMENT

First of all, We would like to thank God for everything. We also would like to thank all the people who helped us during this work. We would like to express our deepest gratitude to our supervisor Dr.Nitin Goyal,Assistant Professor,IT, for his invaluable suggestions and guidance, constant encouragement and patience during the course of this work. We would like to thank the Director, MIET, for providing a rich intellectual environment, and facilities indispensable for the writing of this pre-thesis. Special thanks to Dr.Pradeep Pant, for his constant encouragement and support throughout the course work. We would also like to acknowledge the support of Meerut Institute of Engineering & Technology (MIET), Meerut. U.P., throughout our studies and the support of all the MIET staff. Lastly, and most importantly, we wish to thank our parents. Without their love and support, nothing would have been possible.

Prerna Chaudhary(0906813059) Vishal Singh(0906813082)

ABSTRACT

Maximizing the network throughput while providing fairness is one of the key challenges in wireless LANs (WLANs). This goal is typically achieved when the load of the access points (APs) is balanced. However, recent studies on operational WLANs have shown that AP load is often substantially uneven. To alleviate such imbalance of load, several load balancing schemes have been proposed. These schemes, essentially, require proprietary client software or speciallydesigned WLAN cards at the user computers for controlling the user-AP association.Network overload is one of the key challenges in wireless LANs (WLANs). Recent studies on operational WLANs, shown that AP load is often uneven distribution. To rectify such overload, several load balancing schemes have been proposed. These methods are commonly require proprietary software or hardware at the user side for controlling the user-AP association. In this report we present a new load balancing method by controlling the size of WLAN cells (i.e., APs coverage range), which is conceptually similar to cell breathing in cellular networks. This method does not require any modication to the users neither the IEEE 802.11 standard. It only requires the ability of dynamically changing the transmission power of the AP beacon messages. This method of load balancing is called cell breathing which is mostly used in telecommunication, basically, for CDMA networks. This technique is used for balancing the load in a wireless local area network where the size of the area covered by an access point will be changed according to the load beared by that AP.

Contents
1 INTRODUCTION 1.1 What is cell breathing? 1.2 Existing System . . . . 1.3 Proposed System . . . 1.4 Motivation . . . . . . . 1.5 Objectives . . . . . . . 1.6 Scope . . . . . . . . . 1 1 2 3 3 4 4 5 5 6 6 6 6 8 8 8 9 10 11 12 12 15 15 17 17 17 18 18 18 19 19 20 20 20 21 22

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

SYSTEM ANALYSIS AND DESIGN 2.1 System Study . . . . . . . . . . . . . . 2.2 System Modules . . . . . . . . . . . . . 2.2.1 Client Model . . . . . . . . . . 2.2.2 Server Model . . . . . . . . . . 2.2.3 Network Model . . . . . . . . . 2.2.4 Cell Breathing Approach . . . . 2.2.5 Bottleneck Method . . . . . . . 2.2.6 Congestion Load Minimization 2.3 System Architecture . . . . . . . . . . . 2.3.1 Data Flow Diagram . . . . . . . 2.3.2 State Diagram . . . . . . . . . . 2.3.3 UML Diagram . . . . . . . . . 2.3.4 Class Diagram . . . . . . . . . 2.3.5 Activity Diagram . . . . . . . . 2.3.6 Sequence Diagram . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

. . . . . . . . . . . . . . .

SYSTEM HARDWARE AND SOFTWARE REQUIREMENTS 3.1 Minimum Hardware Requirements . . . . . . . . . . . . . . . 3.2 Software Requirements . . . . . . . . . . . . . . . . . . . . . 3.3 Software Details . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Microsoft Visual C#.Net . . . . . . . . . . . . . . . . 3.3.2 .NET Framework . . . . . . . . . . . . . . . . . . . . 3.3.3 Features of .NET . . . . . . . . . . . . . . . . . . . . 3.4 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . IMPLEMENTATION 4.1 Snapshots . . . . . . . . 4.1.1 Server . . . . . . 4.1.2 Starting Server . 4.1.3 Running Clients

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

iv

4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 5

Sending messages . . . Server before loading . . Loading the Server . . . Sending more messages Load Being Balanced . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

22 23 24 25 25 26 26 26 27 27 28 28 28 30 63

TESTING 5.1 Testing Methods . . 5.1.1 Test Data . 5.2 Functional Testing 5.3 Test Results . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

CONCLUSION AND FUTURE WORK 6.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

APPENDIX REFERENCES

List of Figures
1.1 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 4.1 4.2 4.3 4.4 4.5 4.6 4.7 5.1 Cell Breathing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Connection establishment . . . Basic Architecture . . . . . . DFD . . . . . . . . . . . . . . State Diagram . . . . . . . . . UML Diagram . . . . . . . . Client Class Diagram . . . . . Cell Breathing Class Diagram Activity Diagram . . . . . . . Sequence Diagram . . . . . . Cell Breathing Server . Starting server . . . . . Running Clients . . . . Sending Messages . . . Server Before Loading Loading the server . . Creating more load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 7 9 10 11 12 13 14 15 16 20 21 22 22 23 24 25 27

Test Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

vi

ABBREVIATIONS

Here are certain abbreviations that are frequently used in the report:

Access Point(AP): In computer networking, a wireless access point (AP) is a device that allows wireless devices to connect to a wired network using Wi-Fi, or related standards. The AP usually connects to a router (via a wired network) if its a standalone device, or is part of a router itself. WLAN: A wireless local area network (WLAN) links two or more devices using some wireless distribution method (typically spread-spectrum or OFDM radio), and usually providing a connection through an access point to the wider Internet. This gives users the mobility to move around within a local coverage area and still be connected to the network. RSSI: RSSI stands for Recieved Signal Strength Indicator. In telecommunications, received signal strength indicator (RSSI) is a measurement of the power present in a received radio signal. BSS: BSS stands for Basic Service Set. It refers to a set of access points in a wireless LAN. QoS: QoS stands for Quality of Service. The quality of service (QoS) refers to several related aspects of telephony and computer networks that allow the transport of trafc with special requirements. Quality of service is the ability to provide different priority to different applications, users, or data ows, or to guarantee a certain level of performance to a data ow. For example, a required bit rate, delay, jitter, packet dropping probability and/or bit error rate may be guaranteed.

Chapter 1

INTRODUCTION
1.1 What is cell breathing?

Cell breathing is a well known concept in cellular telephony (2G, 3G, CDMA, CDMA200 and WCDMA systems). It is dened as the constant change in the geographical area covered by the cell tower. When the cell becomes heavily loaded, it shrinks, and the lightly loaded neighboring cells expand. In this way, client trafc from the overloaded cell is redirected to neighboring cells, and consequently, the overall system is load balanced. In CDMA cellular networks, the coverage and capacity of a cell are related with each other. The increase of the number of active users in a cell causes the increase of the total interference sensed at the base station. Therefore, in congested cells, users need to transmit with higher power to maintain a certain signal-to-interference ratio at the receiving base station. As the users in a congested cell increase their transmission power, they also increase their interference to the neighboring cells since all cells use the same frequency band in CDMA networks. As a result, the overall network capacity may decrease. Furthermore, since the maximal transmission power of the users is bounded, the users who are far from the base station may experience poor services. To overcome these problems the cell breathing approach was proposed. This approach shrinks the cell size of congested cells and balances the load by reducing the pilot signal transmission power of the corresponding base stations. In WLANs, cell breathing can be implemented by controlling the transmission power of an APs beacon packets. We do not change the transmission power of data packets to avoid degrading clients performance. In comparison, changing the transmission power of beacon packets only affect how clients associate with APs, and does not affect the loss rate or sending rate of data packets. Clients continue to associate with an AP with the strongest beacon. APs manage their load by adjusting the beacon packets transmission power.In this way, the APs coverage area is shrunk or expanded transparently, adapting to client demands and balancing the trafc load across the network.

Figure 1.1: Cell Breathing

1.2

Existing System

Several studies have proposed a variety of association metrics instead of using the RSSI as the sole criterion. These metrics typically take into account such factors as the number of users currently associated with an AP, the mean RSSI of users currently associated with an AP, and the bandwidth that a new user can get if it is associated with an AP, e.g., Balachandran et al. proposed to associate a user with an AP that can provide a minimal bandwidth required by the user. In Velayos et al. introduced a distributed load balancing architecture were the AP load is dened as the aggregated downlink and uplink trafc through the AP.

In Kumar and co-workers proposed association selection algorithms which are based on the concept of proportional fairness to balance between throughput and fairness. In Kauffmann et al. provided a mathematical foundation for distributed frequency allocation and user association for efcient resource sharing. Recently, in Shakkottai et al. considered a no cooperative multi homing approach and showed that under appropriate pricing, the system throughput is maximized. Most of these works determine only the association of newly arrived users. Tsai et al. is an exception, in which Tsai and Lien proposed to reassociate users when the total load exceeds a certain threshold or the bandwidth allocated to users drops below a certain threshold. While the existing load balancing schemes achieved considerable improvement in terms of throughput and fairness, they require certain support from the client side. In contrast, the proposed scheme does not require any proprietary client support.

1.3

Proposed System

We address the problem of minimizing the load of the congested APs. Let us call the AP with the maximal load as congested AP and its load as congestion load. We use algorithm that nd optimal solution for the complete knowledge model i.e. the IEEE 802.11 k-proposal model for wireless local area network. These results are intriguing, because similar load balancing problems are known to be strong NP-hard. In WLANs, by default, a user scans all available channels and associates itself with an AP that has the strongest received signal strength indicator (RSSI), while being oblivious to the load of APs. As users are, typically, not evenly distributed, some APs tend to suffer from heavy load, while their adjacent APs may carry only light load. Such load imbalance among APs is undesirable as it hampers the network from fully utilizing its capacity and providing fair services to users. Our scheme provides inter-AP fairness by adjusting the cell sizes. The WLAN cell size is changed by controlling the transmission power of the AP beacons. We do not change the transmission power of the data trafc messages. We treat the load of an AP as the aggregation of the load contributions of its associated users. The load contribution may be as simple as the number of users associated with an AP or can be more sophisticated to consider factors like transmission bit rates and trafc demands. The proposed model does neither require any special assistance from users nor any change in the 802.11 standard. It only requires the ability of dynamically changing the transmission power of the AP beacons. Today, commercial AP products already support multiple transmission power levels, so we believe that this requirement can be relatively easily achieved. The network attempts to handle user service requests by readjusting the load across all APs. If an AP cannot accommodate the new session request, the network suggests a location in the network where the request can be satised. Three possible AP states: under-loaded, balanced and overloaded, are dened. The throughput per AP is used as a load metric in deciding the AP state. The node uses this information when choosing an AP to associate with. In the system, for which the technique is proposed, we have complete knowledge i.e. details of MAC layer and physical layer are also known. This information is used for the network model where we will see how an user-AP connection is made.

1.4

Motivation

The problems which we face while connecting to a WLAN basically motivated us to work on such a project. Cell breathing is a technique which till now has only been used in telecommunications but after some research we did on how to overcome the problems being faced by users when they connect to an access point, we came to know about this technique of using cell breathing for balancing the load in a wireless lan. Using cell breathing, we can not only balance the load but the performance of the whole network can also be made better. Several quality of service parameters can be improved by balancing the load on a congested AP without the user being informed about any such technique being used at the back end. If the load becomes too

high on an access point, QoS degrades to an intolerable level. Hence, by balancing the load such problems can be eliminated or atleast their effect on the network can be reduced.

1.5

Objectives

The main objectives are: Preventing an access point from being overloaded Balancing the load of an overloaded access point Maintaining good quality of service

1.6

Scope

Following is the scope of this thesis report: The proposed system is for balancing the load in wlan only. The system assumes that we have a complete knowledge of the network. We assume to use IEEE 802.11 k-proposal system. The performance of the algorithm may or may not be optimal as the problem being dicsussed is an NP hard problem. Performance varies for different networks. Load balanced for one access point sometimes result in some other access point becoming overloaded.

Chapter 2

SYSTEM ANALYSIS AND DESIGN


2.1 System 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 Behavioral/Operational Feasibility

Economic 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 justied. 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 efciently. 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 condence must be raised so that

he is also able to make some constructive criticism, which is welcomed, as he is the nal user of the system. This analysis involves how it will work when it is installed and the assessment of political and managerial environment in which it is implemented. People are inherently resistant to change and computers have been known to facilitate change. The new proposed system is very much useful to the users and therefore it will accept broad audience from around the world.

2.2

System Modules

There are certain modules in the proposed system. These modules are: Client Model Server Model Network Model Cell Breathing Approach Bottleneck Method Congestion Load Minimization

2.2.1

Client Model

A client is an application or system that accesses a remote service on another computer system, known as a server, by way of a network. The term was rst applied to devices that were not capable of running their own stand-alone programs, but could interact with remote computers via a network. These dumb terminals were clients of the time-sharing mainframe computer.

2.2.2

Server Model

In computing, a server is any combination of hardware or software designed to provide services to clients. When used alone, the term typically refers to a computer which may be running a server operating system, but is commonly used to refer to any software or dedicated hardware capable of providing services.

2.2.3

Network Model

Generally, the channel quality is time-varying. For the ser-AP association decision, a user performs multiple samplings of the channel quality, and only the signal attenuation that results from long-term channel condition changes are utilized Our load model can accommodate various additive load denitions such as the number of users associated with an AP. It can also deal with the multiplicative user load contributions.

We consider an IEEE 802.11 WLAN that comprises a set of access points (APs), denoted by A.|A| denotes the number of APs. All APs are attached to a xed infrastructure, which connects them to wired networks, e.g., the Internet. Each AP has a certain transmission range and it can serve only those users that reside in that range. Each AP is congured to use one of K+1 transmission power levels, denoted by Pk . Here, the minimal and maximal levels are denoted by Pmin=P0 and Pmax=PK, respectively. Each power level Pk is identied by its power index k and its transmission power is timesstrongerthanitspredecessor. = [0...K ]
k

Pmax /Pmin i.e. > 1.BecausePk = .Pk1 .Itf ollowsthatPk = Pmin . k f oreveryk

We denote the transmission power of each AP a by Pa . Every user is covered by at least one AP even when all APs are transmitting at the minimal power level Pmin . We dene the network coverage area to be the union of the transmission ranges of all APs. The connection establishment process between a user and an access point can be understood well with the help of the following diagram. In this diagram, source is the user/client and destination is the access point. Other refers to some other client/user who too is trying to connect to the AP. The user must sense the wireless channel to be idle for a DIFS(Distributed InterFrame

Figure 2.1: Connection establishment Space) period before it can attemt to transmit the request for connection. If the medium is determined to be busy, the terminal waits until the end of the current transmission before initiating a backoff procedure. Each station has a Network Allocation Vector (NAV) which predicts how long the medium will be busy. When a node wins contention it begins its transmission using a RTS/CTS frame exchange. The source node sends a short frame called a Request To Send (RTS) to the intended recipient

of the data. On receiving a RTS frame a terminal will generate a Clear To Send (CTS) and after a Short InterFrame Space (SIFS) sends it back to the source. Once a CTS has successfully been received, the originating node waits for a SIFS period and sends the data frame. When the destination station receives the data frame, an acknowledgement frame (ACK) is transmitted after a SIFS. In a heavily loaded WLAN cell, there is a much higher probability of multiple terminals attempting to transmit at one time. This means that the low latency necessary for real-time services cannot be guaranteed.

2.2.4

Cell Breathing Approach

We reduce the load of congested APs by reducing the size of the corresponding cells. Such cell dimensioning can be obtained, for instance, by reducing the transmission power of the congested APs. This forces users near the congested cells boundaries to shift to adjacent (less congested) APs. The transmission bit rate between a user and its associated AP is determined by the quality of the data trafc channel. Transmitting the data trafc with maximal power3 maximizes the APuser SNR and the bit rate. On the other hand, each user determines its association by performing a scanning operation, in which it evaluates the quality of the beacon messages of the APs in its vicinity. By reducing the beacon messages power level of congested APs, we practically shrink the size of their cells, and consequently discourage user association. This concept of controlling the cells dimensions by adapting power levels of the beacon messages is termed cell breathing. The separation between the power levels of the data trafc and the beacon messages is the only modication that we require from APs.

2.2.5

Bottleneck Method

The bottleneck set is a useful means for deciding whether the system congestion load can be further reduced by power reduction operation. Obviously, if the bottleneck set contains APs that transmit with minimal power, power reduction operation cannot be performed.

2.2.6

Congestion Load Minimization

The algorithm presented in this project minimize the load of the congested AP, but they do not necessarily balance the load of the noncongested APs.In this section, we consider min-max load balancing approach that not only minimizes the network congestion load but also balances the load of the noncongested APs. As mentioned earlier, the proposed approach can be used for obtaining various max-min fairness objectives by associating each user with appropriate load contributions. Unfortunately, min-max load balancing is NP-hard problem and it is hard to nd even an approximated solution. In this paper, we solve a variant of the min-max problem, termed min-max priority-load balancing problem, whose optimal solution can be found in polynomial time.

2.3

System Architecture

The basic architecture of the system consists of users/clients, load balancing server and the access points through which the users/clients connect.

Figure 2.2: Basic Architecture

2.3.1

Data Flow Diagram

A data ow diagram (DFD) is a graphical representation of the "ow" of data through an information system, modeling its process aspects.Its a structured analysis and design tool that can be used for owcharting in place of, or in association with, information oriented and process oriented system owcharts. When analysts prepare the Data Flow Diagram, they specify the user needs at a level of detail that virtually determines the information ow into and out of the system and the required data resources. This network is constructed by using a set of symbols that do not imply a physical implementation. The Data Flow Diagram reviews the current physical system, prepares input and output specication, species the implementation plan etc. The data ow diagram shown here represents the ow of data in the system. It can be seen that the ow of data is from users/clients to the server.

Figure 2.3: DFD

10

2.3.2

State Diagram

A state diagram is a type of diagram used in computer science and related elds to describe the behavior of systems. State diagrams require that the system described is composed of a nite number of states.

Figure 2.4: State Diagram

11

2.3.3

UML Diagram

Unied Modeling Language (UML) is a standardized, general-purpose modeling language in the eld of software engineering. The Unied Modeling Language includes a set of graphic notation techniques to create visual models of object-oriented software-intensive systems.

Figure 2.5: UML Diagram

2.3.4

Class Diagram

In software engineering, a class diagram in the Unied Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the systems classes, their attributes, operations (or methods), and the relationships among the classes. Class diagram for client:

12

Figure 2.6: Client Class Diagram Class diagram for Cell Breathing class:

13

Figure 2.7: Cell Breathing Class Diagram

14

2.3.5

Activity Diagram

Activity diagrams are graphical representations of workows of stepwise activities and actions[1] with support for choice, iteration and concurrency.activity diagrams can be used to describe the business and operational step-by-step workows of components in a system. An activity diagram shows the overall ow of control.

Figure 2.8: Activity Diagram

2.3.6

Sequence Diagram

A sequence diagram is a kind of interaction diagram that shows how processes operate with one another and in what order. It is a construct of a Message Sequence Chart. A sequence diagram shows object interactions arranged in time sequence.

15

Figure 2.9: Sequence Diagram

16

Chapter 3

SYSTEM HARDWARE AND SOFTWARE REQUIREMENTS


In this chapter, the hardware and software requirements of the system have been discussed. Every project has some hardware and software requirements and does this project.

3.1

Minimum Hardware Requirements

The minimum hardware requirements for the proposed project are: Processor: Pentium IV RAM: 512 MB Hard Disk Capacity: 40 GB Keyboard: 101 keys Mouse: Optical Mouse

3.2

Software Requirements

The software requirement for the proposed project can be given as: Operating System: Windows XP Professional Front End: Visual Studio .NET 2005 Coding Language: C# Back End: MSSQL Server 2005

17

3.3

Software Details

ASP.NET framework has been used in the development of this project. To program with ASP.NET, c# is probably the most common language. VB Scripts only has one data type the variant data type. The variant is used because of its exibility with all data types. The variant data type is unique in the sense that the variant actually changes behavior depending on the type of data it is storing.

3.3.1

Microsoft Visual C#.Net

Microsoft C#.Net is a modern, object oriented, type safe language. It enables programmers to quickly build a wide range of applications for the new Microsoft.Net platform. More than anything else, C# pronounced "C Sharp" is designed to bring rapid development to the C++ programmer without sacricing the power and control that have been a hallmark of C and C++.

3.3.2

.NET Framework

The Microsoft .NET Framework is a software framework that can be installed on computers running Microsoft Windows operating systems. It includes a large library of coded solutions to common programming problems and a virtual machine that manages the execution of programs written specically for the framework. The .NET Framework is a Microsoft offering and is intended to be used by most new applications created for the Windows platform.

18

3.3.3

Features of .NET

Following are the features of .NET framework which make it a good platform for develpoing softwares: Interoperability Common Runtime Engine Simplied Deployment Security Portability

3.4

Methodology

Waterfall model methodology was followed during the development of this project. It is the basic methodology, most widely used for developing softwares. It is also the most rened and simple methodology to follow. The waterfall model is a sequential design process, often used in software development processes, in which progress is seen as owing steadily downwards (like a waterfall) through the phases of Conception, Initiation, Analysis, Design, Construction, Testing, Production/Implementation, and Maintenance. The waterfall development model originates in the manufacturing and construction industries; highly structured physical environments in which after-the-fact changes are prohibitively costly, if not impossible.

19

Chapter 4

IMPLEMENTATION
4.1
4.1.1

Snapshots
Server

This is our server which will be loaded by sending messages.

Figure 4.1: Cell Breathing Server

20

4.1.2

Starting Server

The server is being started so that clients can connect to it and send messages which later on will result in congestion for the server and that congestion will be balanced later on.

Figure 4.2: Starting server

21

4.1.3

Running Clients

Now, the clients will se started in order to connect to the server. Clients will load the server by sending messages and the server will then face congestion.

Figure 4.3: Running Clients

4.1.4

Sending messages

At this stage, the clients start sending messages to the server.

Figure 4.4: Sending Messages

22

4.1.5

Server before loading

This is the stage when server is not loaded. It will be loaded at the later stages.

Figure 4.5: Server Before Loading

23

4.1.6

Loading the Server

Now, the server is being loaded by the clients by sending a lot of messages.

Figure 4.6: Loading the server

24

4.1.7

Sending more messages

More load is being sent to the server, so, that it can be heavily loaded.

Figure 4.7: Creating more load

4.1.8

Load Being Balanced

At this stage, we see that the load is being balanced by the cell breathing server.

Load being balanced

25

Chapter 5

TESTING
5.1 Testing Methods

There are many testing methods. Some of them are: Unit Testing: In unit testing, the modules of the system are tested as individual units. Each unit has denite input and output parameters and often a denite single function. Hence Unit testing is otherwise known as program testing. On applying the unit testing method, it was found that all the single units are working ne. 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 elds. 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 specically aimed at exposing the problems that arise from the combination of components. The integration testing performed also yeilded good results i.e. the modules when integrated worked ne. System Testing: System testing ensures that the entire integrated software system meets requirements. It tests a conguration to ensure known and predictable results. An example of system testing is the conguration oriented system integration test. System testing is based on process descriptions and ows, emphasizing pre-driven process links and integration points. The system as a whole is also working ne.

5.1.1

Test Data

Data to be entered in this project are Distance coverage, energy, link quality in such a way that if the distance coverage is high then the energy required to transmit the message should also high due to high energy the link quality will be less. Based on this condition the values should be entered at runtime in the table through will rank will be calculated and packets are routed.

26

5.2

Functional Testing

Functional tests provide systematic demonstrations that functions tested are available as specied by the business and technical requirements, system documentation and user manuals. Functional testing is centered on the following items: Valid Input: identied classes of valid input must be accepted. Invalid Input: identied classes of invalid input must be rejected. Functions: identied functions must be exercised. Output: identied classes of application outputs must be exercised.

5.3

Test Results

All the tests mentioned above were passed successfully. No defects encountered.

Figure 5.1: Test Result

27

Chapter 6

CONCLUSION AND FUTURE WORK


6.1 Conclusion

This paper presents a cell breathing concept in cellular WLAN that performs load balancing with the aim of improving the QoS. Access points can dynamically adjust their transmission power in an attempt to shed users to reduce the cell load. Neighbouring APs also make power adjustments to try and ensure that all nodes continue to receive coverage. This load balancing technique allows the network to adapt itself to changing network load conditions in order to maintain or improve the current level of service being provided to users. Results show that the proposed scheme does indeed improve the level of service received by users in the form of lower frame dropping rates and improved overall throughput. Existing solutions for handling congestion fall short since they either result in inefcient utilization of resources and poor performance, or require changes to the client software, which is hard to realize in practice. Our proposal, cell breathing, achieves load balancing by dynamically reconguring cell boundaries. It does not require changes to the client software or the standard, thereby making it rapidly deployable. Cell breathing is implemented by adjusting the power at each AP in the network.Cell breathing technique signicantly out-performs the popular xed power schemes and perform comparably to the sophisticated load balancing techniques where the client and the APs are required to cooperate with one another.Under high load, with cell breathing the throughput improves by up to 50 percent for uniform distributions of client locations.

6.2

Future Work

Each and every project being developed, always has some scope for future enhancement and this cell breathing eld in wireless local area network has immense scope for enhancements. A cell breathing solution can be thought for the models other than that 802.11 k-proposals. The compatiblity issue can be resolved.

28

As the problem is kind of NP hard, new algorithms can always be developed for a better solution as for such problems, no solution is good enough. Solutions can be given for the limited knowledge systems which are mostly used everywhere around. solutions which can lead to the balancing of an AP alongwith the balancing of all the other APs present, can be found.

29

APPENDIX: Cell Breathing Server Code

using using using using using using using using using using

System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Net; System.Net.Sockets; System.IO;

namespace LBServerCode { public partial class CelBreathingServer : Form { DBase db = new DBase(); string path, ClientPath; public CelBreathingServer() { InitializeComponent(); LBSReceive.receivedPath = ""; } private void button1_Click(object sender, EventArgs e) { if (FTServerCode.receivedPath.Length > 0) backgroundWorker1.RunWorkerAsync(); FolderBrowserDialog fd = new FolderBrowserDialog(); if (fd.ShowDialog() == DialogResult.OK) { ClientPath = fd.SelectedPath; for (int i = 1; i <= 3; i++) { System.Diagnostics.Process.Start(ClientPath + "//Client " + i + "//bin//Debug//Client " + i); } } else MessageBox.Show("Please select file receiving path"); } private int RandomNumber(int min, int max) { Random random = new Random();

30

return random.Next(min, max); } private void timer1_Tick(object sender, EventArgs e) { label5.Text = LBSReceive.receivedPath; label3.Text = LBSReceive.curMsg; lblserver1.Text = LBSReceive.loadst1.ToString(); lblserver2.Text = LBSReceive.loadst2.ToString(); lblserver3.Text = LBSReceive.loadst3.ToString(); progressBar1.Value = LBSReceive.loadst1; progressBar2.Value = LBSReceive.loadst2; progressBar3.Value = LBSReceive.loadst3; } LBSReceive obj = new LBSReceive(); private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { obj.StartServer(); } private void button2_Click(object sender, EventArgs e) { FolderBrowserDialog fd = new FolderBrowserDialog(); if (fd.ShowDialog() == DialogResult.OK) { LBSReceive.receivedPath = fd.SelectedPath; } } private void Form1_Load(object sender, EventArgs e) { path = Directory.GetParent(Application.StartupPath).ToString(); } int a = 0; private void timer2_Tick(object sender, EventArgs e) { int returnValue = RandomNumber(1, 20); a1.Text = returnValue.ToString(); if (returnValue == 1) { db.command("delete FROM Engine1 where Id in ( SELECT TOP 2 Id FROM Engine1)"); db.conclose(); LoadStatus(); } else if (returnValue == 2)

31

{ db.command("delete FROM Engine2 where Id in ( SELECT TOP 2 Id FROM Engine2)"); db.conclose(); LoadStatus(); } else if (returnValue == 3) { db.command("delete FROM Engine3 where Id in ( SELECT TOP 2 Id FROM Engine3)"); db.conclose(); LoadStatus(); } } public void LoadStatus() { db.reader("Select Count(Msg) from Engine1"); db.dr.Read(); LBSReceive.loadst1 = Convert.ToInt32(db.dr.GetValue(0)); db.conclose(); db.reader("Select Count(Msg) from Engine2"); db.dr.Read(); LBSReceive.loadst2 = Convert.ToInt32(db.dr.GetValue(0)); db.conclose(); db.reader("Select Count(Msg) from Engine3"); db.dr.Read(); LBSReceive.loadst3 = Convert.ToInt32(db.dr.GetValue(0)); db.conclose(); if (LBSReceive.loadst1 > 80 && LBSReceive.loadst3 > 50) { db.command("delete From Engine1"); db.conclose(); } else if (LBSReceive.loadst3 > 80 && LBSReceive.loadst2 > 50) { db.command("delete From Engine3"); db.conclose(); } else if (LBSReceive.loadst3 > 50 && LBSReceive.loadst1 > 50) { db.command("delete From Engine2"); db.conclose(); } } private void button2_Click_1(object sender, EventArgs e)

32

{ System.Diagnostics.Process.Start(path + "/Cell Breathing.exe"); } private void button3_Click(object sender, EventArgs e) { FolderBrowserDialog fd = new FolderBrowserDialog(); if (fd.ShowDialog() == DialogResult.OK) { ClientPath = fd.SelectedPath; for (int i = 1; i <= 3; i++) { System.Diagnostics.Process.Start(ClientPath + "//Client " + i + "//bin//Debug//Client " + i); } } } } //FILE TRANSFER USING C#.NET SOCKET - SERVER class LBSReceive { DBase db = new DBase(); IPEndPoint ipEnd; Socket sock; public LBSReceive() { LoadStatus(); IPHostEntry ipEntry = Dns.GetHostEntry(Environment.MachineName); IPAddress IpAddr = ipEntry.AddressList[0]; ipEnd = new IPEndPoint(IpAddr, 5655); sock = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp); sock.Bind(ipEnd); } public public public public public public { try { curMsg = "Starting..."; sock.Listen(100); LoadStatus(); curMsg = "Running....."; static string receivedPath; static string curMsg = "Stopped"; static int loadst1 = 0; static int loadst2 = 0; static int loadst3 = 0; void StartServer()

33

Socket clientSock = sock.Accept(); byte[] clientData = new byte[1024]; int receivedBytesLen = clientSock.Receive(clientData); string a=clientSock.ReceiveBufferSize.ToString(); int b = a-1024; string s = Encoding.ASCII.GetString(clientData, 0, 1); if (s == "1") { s = ""; s = "M1"; } else if (s == "2") { s = ""; s = "M2"; } else if (s == "3") { s = ""; s = "M3"; } MessageBox.Show(s.ToString()); int fileNameLen = BitConverter.ToInt32(clientData, 1); string fileString = Encoding.ASCII.GetString(clientData, 1, 1022); int i = 0; string t =""; while(clientData[i] != Convert.ToByte( \0) ) { fi[i] = clientData[i]; t += fi.ToString(); i++; } byte[] final = new byte[i]; for (int j = 0; j < i; j++) { final[j] = clientData[j+1]; } string fileString = Encoding.ASCII.GetString(final); LoadStatus(); if (loadst1 != 100 || loadst2 != 100 || loadst3 != 100) { if (loadst1 == loadst2 && loadst1 == loadst3) { load("Engin1", s, fileString); db.command("insert into Engine1 values(" + s.ToString() + "," + fileString.ToString() + ") ");

34

db.conclose(); } else { if (loadst1 < loadst2 && loadst1 < loadst3) { db.command("insert into Engine1 values (" + s + "," + fileString + ") "); db.conclose(); } else if (loadst2 < loadst3) { db.command("insert into Engine2 values (" + s + "," + fileString + ") "); db.conclose(); } else { db.command("insert into Engine3 values (" + s + "," + fileString + ") "); db.conclose(); } } } else {

} LoadStatus(); MessageBox.Show(fileString); clientSock.Close(); StartServer();

} catch (Exception ex) { curMsg = "File Receving error."; } } public void LoadStatus() { db.reader("Select Count(Msg) from Engine1"); db.dr.Read();

35

loadst1 = Convert.ToInt32(db.dr.GetValue(0)); db.conclose(); db.reader("Select Count(Msg) from Engine2"); db.dr.Read(); loadst2 = Convert.ToInt32(db.dr.GetValue(0)); db.conclose(); db.reader("Select Count(Msg) from Engine3"); db.dr.Read(); loadst3 = Convert.ToInt32(db.dr.GetValue(0)); db.conclose(); if (loadst1 > 80 && loadst3 > 50) { db.command("delete From Engine1"); db.conclose(); } else if (loadst3 > 80 && loadst2 > 50) { db.command("delete From Engine3"); db.conclose(); } else if (loadst3 > 50 && loadst1 > 50) { db.command("delete From Engine2"); db.conclose(); } } public void Load(string Engine, string From, string Msg) { db.command("insert into " + Engine + "values (" + From + "," + Msg + ") "); db.conclose();

} } }

Program.cs: using System; using System.Collections.Generic; using System.Windows.Forms; namespace LBServerCode

36

{ static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new CelBreathingServer()); } } }

DBase.cs: using using using using using System; System.Collections.Generic; System.Text; System.Data.SqlClient; System.Data;

namespace LBServerCode { class DBase { public SqlConnection con; public SqlCommand cmd; public SqlDataAdapter da; public SqlDataReader dr; public DataTable dt; public DataSet ds;

public void conn() { con = new SqlConnection("server=Prerna-Vaio;initial catalog=LBS;uid=sa;pwd=prerna13"); con.Open(); } public void command(string query) { conn(); cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery();

37

} public void reader(string query) { conn(); cmd = new SqlCommand(query, con); dr = cmd.ExecuteReader(); } public void addapter(string query,string tbl) { conn(); da = new SqlDataAdapter(query,con ); da.Fill(ds, tbl); } public void conclose() { con.Close(); } } }

Code for client 1

using using using using using using using using using using using

System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient; System.Net.Sockets; System.Net; System.IO;

namespace Server { public partial class Client : Form {

string fileDes,fileini; int len; public Client() {

38

InitializeComponent(); } private void Normal_File_Load(object sender, EventArgs e) {

} private void btnOpen_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); fileDes = openFileDialog1.FileName; if (fileDes == "openFileDialog1") { lblError.Text = ""; lblError.Text = "Select a File first"; txtFilePath.Text = ""; } else { len = fileDes.Length; fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1); } btnSend.Enabled = true; } private void btnSend_Click(object sender, EventArgs e) { send1(txtMsg.Text );

} public void send1(string data) { try { IPAddress[] ipAddress = Dns.GetHostAddresses(txtIp.Text); IPEndPoint ipEnd = new IPEndPoint(IPAddress.Parse (txtIp.Text.Trim() ), 5655); Socket clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP); byte[] m = Encoding.ASCII.GetBytes("1"); byte[] fileNameByte = Encoding.ASCII.GetBytes(data ); byte []sendmsg=new byte[m.Length+fileNameByte.Length ];

39

m.CopyTo(sendmsg,0); fileNameByte.CopyTo(sendmsg,1); string test = Convert.ToString(sendmsg ); clientSock.Connect(ipEnd); clientSock.Send(sendmsg); clientSock.Close(); } catch (Exception ex) { if (ex.Message == "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond") { lblError.Text = ""; lblError.Text = "No Such System Available Try other IP"; } else { if (ex.Message == "No connection could be made because the target machine actively refused it") { lblError.Text = ""; lblError.Text = "File Sending fail. Because server not running."; } else { lblError.Text = ""; lblError.Text = "File Sending fail." + ex.Message; } } } }

private void timer1_Tick(object sender, EventArgs e) { if (txtMsg.Text == "") { btnSend.Enabled = false; BtnClear.Enabled = false; } else {

40

btnSend.Enabled = true; BtnClear.Enabled = true } } private void groupBox1_Enter(object sender, EventArgs e) { } private void BtnClear_Click(object sender, EventArgs e) { txtMsg.Text = ""; } } } . client1.designer.cs: using using using using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient; System.Net.Sockets; System.Net; System.IO;

namespace Server { public partial class Client : Form {

string fileDes,fileini; int len; public Client() { InitializeComponent(); } private void Normal_File_Load(object sender, EventArgs e) {

41

} private void btnOpen_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); fileDes = openFileDialog1.FileName; if(fileDes == "openFileDialog1") { lblError.Text = ""; lblError.Text = "Select a File first"; txtFilePath.Text = ""; } else { len = fileDes.Length; fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1); } btnSend.Enabled = true; } private void btnSend_Click(object sender, EventArgs e) { send1(txtMsg.Text );

} public void send1(string data) { try { IPAddress[] ipAddress = Dns.GetHostAddresses (txtIp.Text); IPEndPoint ipEnd = new IPEndPoint(IPAddress.Parse (txtIp.Text.Trim() ), 5655); Socket clientSock = new Socket(AddressFamily. InterNetwork, SocketType.Stream, ProtocolType.IP); byte[] m = Encoding.ASCII.GetBytes("1"); byte[] fileNameByte = Encoding.ASCII.GetBytes(data ); byte []sendmsg=new byte[m.Length+fileNameByte.Length ]; m.CopyTo(sendmsg,0); fileNameByte.CopyTo(sendmsg,1); string test = Convert.ToString(sendmsg ); clientSock.Connect(ipEnd);

42

clientSock.Send(sendmsg); clientSock.Close();

} catch (Exception ex) {

if (ex.Message == "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to res { lblError.Text = ""; lblError.Text = "No Such System Available Try other IP"; } else { if (ex.Message == "No connection could be made because the target machine actively refused it") { lblError.Text = ""; lblError.Text = "File Sending fail. Because server not running."; } else { lblError.Text = ""; lblError.Text = "File Sending fail." + ex.Message; } } } }

private void timer1_Tick(object sender, EventArgs e) { if (txtMsg.Text == "") { btnSend.Enabled = false; BtnClear.Enabled = false; } else { btnSend.Enabled = true; BtnClear.Enabled = true; } }

43

private void groupBox1_Enter(object sender, EventArgs e) { } private void BtnClear_Click(object sender, EventArgs e) { txtMsg.Text = ""; } } }

Code for Client 2 Client2.cs:

using using using using using using using using using using using

System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient; System.Net.Sockets; System.Net; System.IO;

namespace Server { public partial class Client : Form {

string fileDes,fileini; int len; public Client() { InitializeComponent(); } private void Normal_File_Load(object sender, EventArgs e) {

44

private void btnOpen_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); fileDes = openFileDialog1.FileName; if (fileDes == "openFileDialog1") { lblError.Text = ""; lblError.Text = "Select a File first"; txtFilePath.Text = ""; } else { len = fileDes.Length; fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1); } btnSend.Enabled = true; } private void btnSend_Click(object sender, EventArgs e) { send1(txtMsg.Text );

} public void send1(string data) { try { IPAddress[] ipAddress = Dns.GetHostAddresses(txtIp.Text ); IPEndPoint ipEnd = new IPEndPoint(ipAddress[0], 5655); Socket clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

byte[] fileNameByte = Encoding.ASCII.GetBytes("2"+data ); clientSock.Connect(ipEnd); clientSock.Send(fileNameByte); clientSock.Close();

} catch (Exception ex)

45

{ if (ex.Message == "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond") { lblError.Text = ""; lblError.Text = "No Such System Available Try other IP"; } else { if (ex.Message == "No connection could be made because the target machine actively refused it") { lblError.Text = ""; lblError.Text = "File Sending fail. Because server not running."; } else { lblError.Text = ""; lblError.Text = "File Sending fail." + ex.Message; } } } }

private void timer1_Tick(object sender, EventArgs e) { if (txtMsg.Text == "") { btnSend.Enabled = false; BtnClear.Enabled = false; } else { btnSend.Enabled = true; BtnClear.Enabled = true; } } private void groupBox1_Enter(object sender, EventArgs e) { } private void BtnClear_Click(object sender, EventArgs e)

46

{ txtMsg.Text = ""; } private void label3_Click(object sender, EventArgs e) { } } }

Program.cs:

using System; using System.Collections.Generic; using System.Windows.Forms; namespace Server { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Client ()); } } }

Code for Client 3 Client3.cs:

using using using using using using using using using

System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Data.SqlClient; System.Net.Sockets;

47

using System.Net; using System.IO; namespace Server { public partial class Client : Form {

string fileDes,fileini; int len; public Client() { InitializeComponent(); } private void Normal_File_Load(object sender, EventArgs e) {

} private void btnOpen_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); fileDes = openFileDialog1.FileName; if (fileDes == "openFileDialog1") { lblError.Text = ""; lblError.Text = "Select a File first"; txtFilePath.Text = ""; } else { len = fileDes.Length; fileini = fileDes.Substring(fileDes.IndexOf("\\") + 1); } btnSend.Enabled = true; } private void btnSend_Click(object sender, EventArgs e) { send1(txtMsg.Text );

48

public void send1(string data) { try { IPAddress[] ipAddress = Dns.GetHostAddresses(txtIp.Text ); IPEndPoint ipEnd = new IPEndPoint(ipAddress[0], 5655); Socket clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);

byte[] fileByte = Encoding.ASCII.GetBytes("3"+data ); clientSock.Connect(ipEnd); clientSock.Send(fileByte); clientSock.Close();

} catch (Exception ex) { if (ex.Message == "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond") { lblError.Text = ""; lblError.Text = "No Such System Available Try other IP"; } else { if (ex.Message == "No connection could be made because the target machine actively refused it") { lblError.Text = ""; lblError.Text = "File Sending fail. Because server not running."; } else { lblError.Text = ""; lblError.Text = "File Sending fail." + ex.Message; } } } }

49

private void timer1_Tick(object sender, EventArgs e) { if (txtMsg.Text == "") { btnSend.Enabled = false; BtnClear.Enabled = false; } else { btnSend.Enabled = true; BtnClear.Enabled = true; } } private void groupBox1_Enter(object sender, EventArgs e) { }

private void BtnClear_Click(object sender, EventArgs e) { txtMsg.Text = ""; } } }

Client3.designer.cs:

namespace Server { partial class Client { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// /// /// /// <summary> Clean up any resources being used. </summary> <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing)

50

{ if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method /// with the code editor. /// </summary> private void InitializeComponent() { this.components = new System. ComponentModel.Container(); this.btnSend = new System.Windows. Forms.Button(); this.openFileDialog1 = new System.Windows. Forms.OpenFileDialog(); this.timer1 = new System.Windows. Forms.Timer(this.components); this.label5 = new System.Windows. Forms.Label(); this.groupBox1 = new System.Windows. Forms.GroupBox(); this.BtnClear = new System.Windows. Forms.Button(); this.txtMsg = new System.Windows. Forms.TextBox(); this.label8 = new System.Windows. Forms.Label(); this.groupBox2 = new System.Windows. Forms.GroupBox(); this.label3 = new System.Windows. Forms.Label(); this.txtIp = new System.Windows. Forms.TextBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // btnSend // this.btnSend.BackColor = System.Drawing. Color.Transparent;

51

this.btnSend.Font = new System.Drawing. Font("Verdana", 12F, System.Drawing. FontStyle.Bold, System.Drawing.GraphicsUnit. Point, ((byte)(0))); this.btnSend.ForeColor = System.Drawing.Color.Black; this.btnSend.Location = new System. Drawing.Point(71, 181); this.btnSend.Name = "btnSend"; this.btnSend.Size = new System.Drawing.Size(75, 27); this.btnSend.TabIndex = 5; this.btnSend.Text = "Send"; this.btnSend.UseVisualStyleBackColor = false; this.btnSend.Click += new System. EventHandler(this.btnSend_Click); openFileDialog1; this.openFileDialog1.FileName = "openFileDialog1"; // // timer1 // this.timer1.Enabled = true; this.timer1.Tick += new System. EventHandler(this.timer1_Tick); // // label5 // this.label5.BackColor = System.Drawing. Color.Transparent; this.label5.Font = new System.Drawing. Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold, System. Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.ForeColor = System.Drawing. Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); this.label5.Location = new System. Drawing.Point(12, 9); this.label5.Name = "label5"; this.label5.Size = new System.Drawing. Size(351, 75); this.label5.TabIndex = 13; this.label5.Text = "Cell Breathing Techniques for Load Balancing in Wirless LANs"; this.label5.TextAlign = System.Drawing. ContentAlignment.MiddleCenter; // // groupBox1

52

// this.groupBox1.BackColor = System.Drawing. Color.Transparent; this.groupBox1.Controls.Add(this.BtnClear); this.groupBox1.Controls.Add(this.btnSend); this.groupBox1.Controls.Add(this.txtMsg); this.groupBox1.Controls.Add(this.label8); this.groupBox1.Font = new System.Drawing. Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBox1.ForeColor = System.Drawing. Color.MidnightBlue; this.groupBox1.Location = new System. Drawing.Point(26, 160); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System. Drawing.Size(340, 280); this.groupBox1.TabIndex = 14; this.groupBox1.TabStop = false; this.groupBox1.Text = " Message Editor"; // // BtnClear // this.BtnClear.BackColor = System.Drawing. Color.Transparent; this.BtnClear.Font = new System.Drawing. Font("Verdana", 12F, System.Drawing.FontStyle.Bold); this.BtnClear.ForeColor = System.Drawing. Color.Black; this.BtnClear.Location = new System. Drawing.Point(152, 181); this.BtnClear.Name = "BtnClear"; this.BtnClear.Size = new System. Drawing.Size(75, 27); this.BtnClear.TabIndex = 2; this.BtnClear.Text = "Clear"; this.BtnClear.UseVisualStyleBackColor = false; this.BtnClear.Click += new System. EventHandler(this.BtnClear_Click); // // txtMsg // this.txtMsg.Location = new System. Drawing.Point(20, 74); this.txtMsg.Multiline = true; this.txtMsg.Name = "txtMsg"; this.txtMsg.ScrollBars = System.Windows.

53

Forms.ScrollBars.Vertical; this.txtMsg.Size = new System.Drawing.Size(293, 91); this.txtMsg.TabIndex = 1; // // label8 // this.label8.AutoSize = true; this.label8.Font = new System. Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label8.ForeColor = System.Drawing.Color.Maroon; this.label8.Location = new System.Drawing.Point(17, 43); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(142, 18); this.label8.TabIndex = 0; this.label8.Text = "Text Message :"; // // groupBox2 // this.groupBox2.BackColor = System.Drawing.Color.Transparent; this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.txtIp); this.groupBox2.Location = new System.Drawing.Point(26, 87); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(340, 52); this.groupBox2.TabIndex = 16; this.groupBox2.TabStop = false; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing. Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold, System. Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing. SystemColors.ActiveCaptionText; this.label3.Location = new System.Drawing.Point(6, 20); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(168, 19); this.label3.TabIndex = 7; this.label3.Text = "Destination IpAddress :"; // // txtIp // this.txtIp.BackColor = System.Drawing. SystemColors.ButtonHighlight;

54

this.txtIp.Location = new System.Drawing. Point(180, 17); this.txtIp.Name = "txtIp"; this.txtIp.ReadOnly = true; this.txtIp.Size = new System.Drawing.Size(154, 27); this.txtIp.TabIndex = 4; this.txtIp.Text = " "; // // Client // this.AutoScaleDimensions = new System.Drawing. SizeF(10F, 18F); this.AutoScaleMode = System.Windows.Forms. AutoScaleMode.Font; this.BackColor = System.Drawing.Color. DarkSlateGray; this.BackgroundImage = global::Client. Properties.Resources. vector_trance_background_14_by_dragonart; this.ClientSize = new System.Drawing.Size(397, 464); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.label5); this.Font = new System.Drawing.Font("Verdana", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Client"; this.Text = "Client 3"; this.Load += new System.EventHandler(this.Normal_File_Load); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); } #endregion private private private private private private private private System.Windows.Forms.Button btnSend; System.Windows.Forms.OpenFileDialog openFileDialog1; System.Windows.Forms.Timer timer1; System.Windows.Forms.Label label5; System.Windows.Forms.GroupBox groupBox1; System.Windows.Forms.Button BtnClear; System.Windows.Forms.TextBox txtMsg; System.Windows.Forms.Label label8;

55

private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txtIp; } } namespace Server static class Program /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Client ()); Btree Code: #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include <vector> using namespace std; #define TREENODE CBinaryTreeNode<KEY, DATA> #define LEFT Childs[0] #define RIGHT Childs[1] template <class KEY, class DATA> class CBinaryTreeNode { public: CBinaryTreeNode() { Parent = LEFT = RIGHT = NULL; Count = ID = 0; ArrayEqualIDs = NULL; } ~CBinaryTreeNode() { if(ArrayEqualIDs) delete ArrayEqualIDs; } public: // node parent, left, right respectively TREENODE *Parent, *Childs[2]; // node key KEY Key; // node data DATA Data; // node repetition count int Count; // node ID int ID; // node repeated keys IDs vector<int> *ArrayEqualIDs;

56

const TREENODE& operator=(const TREENODE& node) { Key = node.Key; Data = node.Data; Count = node.Count; ID = node.ID; if(node.ArrayEqualIDs) { if(ArrayEqualIDs == NULL) ArrayEqualIDs = new vector<int>; *ArrayEqualIDs = *node.ArrayEqualIDs; } return *this; } }; template <class KEY, class ARG_KEY, class DATA, class ARG_DATA> class CBinaryTree { public: CBinaryTree() { Root = Nil = NULL; Count = Serial = 0; Modified = NoRepeat = false; } ~CBinaryTree() { RemoveAll(); } public: // tree root node TREENODE* Root, * Nil; // tree nodes count int Count, Serial; // flag to indicate if the tree is modified or not bool Modified; // ignore repeated keys in the Add function bool NoRepeat; // return tree nodes count inline int GetCount() const { return Count; } // check if the tree is empty or not inline bool IsEmpty() const { return Count == 0; } // remove all tree nodes void RemoveAll() { TREENODE *node = Root, *pTemp; while(node != Nil)

57

{ // check for left child if(node->LEFT != Nil) node = node->LEFT; // check for right child else if(node->RIGHT != Nil) node = node->RIGHT; else // node has no childs { // save node pointer pTemp = node; // set node pointer at its parent to NULL if(node->Parent != Nil) node->Parent->Childs[node != node-> Parent->LEFT] = Nil; // update pointer node to its parent node = node->Parent; // delete the saved node delete pTemp; } } Count = Serial = 0; Root = Nil; Modified = false; } // insert key in the tree inline TREENODE* Insert(ARG_KEY key, int nID = -1, TREENODE* node = NULL) { if(Root == Nil) { Root = NewNode(); node = Root; } else { if(node == NULL) node = Root; int nResult; while(true) { nResult = node->Key.compare(key); if(nResult == 0) { node->Count++; if(NoRepeat == false) { if(node->ArrayEqualIDs == NULL) node->ArrayEqualIDs = new vector<int>; node->ArrayEqualIDs->push_back(nID == -1 ?

58

Serial : nID); Serial++; Count++; } return node; } nResult = nResult > 0 ? 0 : 1; if(node->Childs[nResult] == Nil) { node->Childs[nResult] = NewNode(); node->Childs[nResult]->Parent = node; node = node->Childs[nResult]; break; } node = node->Childs[nResult]; } } node->Key = key; node->ID = nID == -1 ? Serial : nID; Serial++; Count++; node->Count++; Modified = true; return node; } // search for a key in the tree inline TREENODE* Search(ARG_KEY key, TREENODE* node = NULL) const { if(node == NULL) node = Root; int nResult; while(node != Nil && (nResult = node-> Key.compare(key)) != 0) node = node->Childs[nResult < 0]; return node == Nil ? NULL : node; } // return minimum key in the tree TREENODE* Min(TREENODE* node) const { // iterate in the left branch while(node != Nil && node->LEFT != Nil) node = node->LEFT; return node; } // return maximum key in the tree TREENODE* Max(TREENODE* node) const {

59

// iterate in the right branch while(node != Nil && node->RIGHT != Nil) node = node->RIGHT; return node; } // return node successor TREENODE* Successor(TREENODE* node) const { // return the left most node in the right subtree if(node->RIGHT != Nil) return Min(node->RIGHT); // go up from node until we find a node that is the left of its parent TREENODE* Parent = node->Parent; while(Parent != Nil && node == Parent->RIGHT) { node = Parent; Parent = node->Parent; } return Parent; } // return node predecessor TREENODE* Predecessor(TREENODE* node) const { // return the right most node in the left subtree if(node->LEFT != Nil) return Max(node->LEFT); // go up from node until we find a node that is the right of its parent TREENODE* Parent = node->Parent; while(Parent != Nil && node == Parent->LEFT) { node = Parent; Parent = node->Parent; } return Parent; } // delete node // 1- node has no child, remove it // 2- node has one child, splice it (connect its parent and child) // 3- node has two childs, splice its successor and put it in its place void Delete(TREENODE* node) { TREENODE *pSplice = (node->LEFT == Nil || node->RIGHT == Nil) ?node:Successor(node);

60

TREENODE *pChild = pSplice->Childs [pSplice->LEFT == Nil]; // connect child to spliced node parent if(pChild != Nil) pChild->Parent = pSplice->Parent; // connect spliced node parent to child if(pSplice->Parent == Nil) Root = pChild; else pSplice->Parent->Childs[pSplice != pSplice->Parent->LEFT] = pChild; // put spliced node in place of node (if required) if(pSplice != node) { // copy spliced node *node = *pSplice; // delete the spliced node delete pSplice; } else // delete the node delete node; Count--; } // save all tree nodes in a vector of integers void Save(vector<int> &nArraySort, bool bAscending = true, bool (* lpfn)(int, int) = NULL) { nArraySort.resize(Count); int nIndex = 0, *pArray = &*nArraySort.begin(); TREENODE* node = bAscending ? Min(Root) : Max(Root); while(node != Nil) { if(lpfn) (*lpfn)(nIndex++, Count); SaveNode(node, pArray); node = bAscending ? Successor(node) : Predecessor(node); } Modified = false; } // add one node to a vector of integers void SaveNode(TREENODE* node, int*& pArray) { *pArray++ = node->ID; if(node->ArrayEqualIDs) { memcpy(pArray, &*node->ArrayEqualIDs->begin(), node->ArrayEqualIDs->size()*sizeof(int));

61

pArray += node->ArrayEqualIDs->size(); } } protected: virtual TREENODE* NewNode() { return new TREENODE(); } };

62

REFERENCES 1. A. Jalali, "On Cell Breathing in CDMA Networks," Proc. IEEE Intl Conf. Comm. (ICC 98), pp. 985-988, 1998. 2. A. Balachandran, P. Bahl, and G.M. Voelker, "Hot-Spot Congestion Relief and Service Guarantees in Public-Area Wireless Networks," SIGCOMM Computing Comm. Rev., vol. 32, no. 1, pp. 59-59, 2002. 3. I. Papanikos and M. Logothetis, "A Study on Dynamic Load Balance for IEEE 802.11b Wireless LAN," Proc. Intl Conf. Comm.Control (COMCON 01), 2001. 4. I. Tinnirello and G. Bianchi, "A Simulation Study of Load Balancing Algorithms in Cellular Packet Networks," Proc. ACM/ IEEE Intl Workshop Modeling, Analysis and Simulation of Wireless and Mobile Systems (MSWiM 01), pp. 73-78, 2001. 5. M. Balazinska and P. Castro, "Characterizing Mobility and Network Usage in a Corporate Wireless Local-Area Network,"Proc. USENIX Intl Conf. Mobile Systems, Applications, and Services (MobiSys 03), 2003. 6. P. Bahl, M.T. Hajiaghayi, K. Jain, V.S. Mirrokni, L. Qiu, and A. Saberi, "Cell Breathing in Wireless LANs: Algorithms and Evaluation," IEEE Trans. Mobile Computing, vol. 6, no. 2, pp. 164- 178, Feb. 2007. 7. S. Shakkottai, E. Altman, and A. Kumar, "The Case for Non- Cooperative Multihoming of Users to Access Points in IEEE 802.11 WLANs," Proc. IEEE INFOCOM, 2006. 8. T.-C. Tsai and C.-F. Lien, "IEEE 802.11 Hot Spot Load Balance and QoS-Maintained Seamless Roaming," Proc. Natl Computer Symp., 2003. 9. T. Togo, I. Yoshii, and R. Kohno, "Dynamic Cell-Size Control According to Geographical Mobile Distribution in a DS/CDMA Cellular System," Proc. IEEE Personal, Indoor, and Mobile Radio Comm. Symp. (PIMRC 98), pp. 677-681, 1998. 10. T. Henderson, D. Kotz, and I. Abyzov, "The Changing Usage of a Mature Campus-Wide Wireless Network," Proc. ACM MobiCom, pp. 187-201, 2004. 11. www.en.wikipedia.org 12. www.w3school.com 13. Y. Bejerano and S.-J. Han, "Cell Breathing Techniques for Load Balancing in Wireless LANs," Proc. IEEE INFOCOM, 2006. 14. Y. Bejerano, S.-J. Han, and L.E. Li, "Fairness and Load Balancing in Wireless LANs Using Association Control," Proc. ACM MobiCom, pp. 315-329, 2004.

63

You might also like