simple wireless ad hoc distributed network

Upload: richygill

Post on 03-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    1/11

    encampment can only be reached by helicopter, and is serviced by three private helicopter

    companies providing access to the nearest town. Visitors and residents can book passage in or

    out of the encampment through any helicopter company. The number of seats on a helicopter

    flight is very limited and the companies are collectively responsible for satisfying demand,

    and must load-share as necessary. You have to design, build, test and demonstrate a

    distributed booking system for the helicopter companies. The focus of the project is on

    choosing an appropriate organization of the system and suitable algorithms for ticket booking

    and cancellation. The prototype implementation should use only sockets for communication

    between the parts of the system and should be written in Java. Your design may ignore

    security and availability concerns specifically you may assume that nodes and disks do not

    fail but you should allow for the possibility of communication failure. You need only providea rudimentary user interface. However, in designing the system you should also consider that

    such a system might have to scale to support different deployments.

    The distributed network architecture is an ad hoc architecture based on the basic service set

    (BSS) of a wireless LAN modular paradigm; each module consisting of a server object and

    server object database, and a server client/s object. In such a network, wireless modules can

    form a network without the need of an access point (AP).

    Figure 1. Wireless Ad hoc Network architecture

    I . Design Brief

    R. Gill

    2. Description of the Functional and Technical Architecture

    The scenario for this system is a (real!) remote encampment in northern Scandinavia. The

    Simple Wireless Ad Hoc Distributed Network

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    2/11

    In essence, the system comprises of multiple client-server modules each of which pass

    commands to all other connected client-server modules. Any query (command) passed to a

    server is also passed to all servers in the network; each server can receive commands and passinformation to and from either clients or servers.

    Figure 2. Overall System flow of events and processes

    3. Overall System Flow

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    3/11

    Each client runs a ticketClient object jar file, and a configuration.txt file to provide module

    specific connection information, the configuration.txt file contains the IP and port number

    information for that particular module to which that ticketClient object and clientServer is

    assigned to.

    Figure 3. ticketClient and ticketServer object functional components.

    4. Functional Components

    4.1 ticketClient functional components.

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    4/11

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    5/11

    Figure 4 Message Passing Sequence

    Twenty three possible message passing events take place in the system as shown in Figure 5.

    Figure 5. Message passing events and commands.

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    6/11

    Data is sent around the network as tokenised string packets, governed by the OSI Network

    Layer. These packets require path determination and logical addressing (IP) information,

    furnished by the Data Link / Network layer and serverlist.txt, config.txt files, respectively.

    The packets are tokenised for easier management of string bytes (words) for display in graphs

    and GUI text fields, and database query formation.

    Multithreading is achieved by the ticketServer that implements as runnable public void run (

    ). The run ( ) executes independently in each clientThread, thereby creating new instances for

    each clientThread. The run ( ) reads and processes commands from either other ticketServers

    or ticketClients.

    The socket is a piece of abstraction software used to represent the

    terminals

    between twoentities (machine/node) in a network, for a given connection then, there exists a socket on

    each entity. Using Java a socket is created to make a connection between entities, with

    accompanying InputStream and OutputStream (or with convertors, Reader and Writer,

    respectively) from the socket to be able to treat the connection as an IO (input/outut) stream

    object.

    There are two stream;based socket classes: a ServerSocket at the server used tolisten for

    incoming connections, and a Socket at the client used to initiate a connection. Once a client

    makes a socket connection the ServerSocket returns a corresponding server side socket using

    an accept ( ), through which direct communication may take place, at this point a socket to

    socket connection exists and both ends may be treated the same way, as they are in effect the

    same. Once the socket to socket connection is make, getInputStream ( ) and getOutput ( ) areused to produce corresponding InputStream and OutputStream objects from each socket.

    The function of the serversocket, then is to wait until another network entity connects to it,

    then to return an actual socket, in effect to create a socket when a network entity attempts to

    make a connection.The listening and established sockets are associated with the same

    serversocket, where the listening socket does not actually actually accept data in the form of

    packets, only requests for new connections.

    When creating a serversocket only port number is required, on creating a socket however both

    IP address and port number is required, in most cases the accept ( ) contains this information.

    The network is easily scalable in 5 simple steps, extra modules can be added by

    1) Replicating ticketClient and ticketServer and database components.

    2) Assigning a module identity (location to database system table)

    3) Assigning IP Address and Port to config.txt.

    4) Adding Server Name, IP address, Port to serverlist.txt.

    5) Replacing all serverlist.txt with new serverlist.txt.

    (For database management higher volume relational databases may be substituted for MS

    access. )

    The combination of hashtables, map and linkedlist at the ticketClient provides for speed when

    accessing high data volume from multiple remote locations (nodes). The nature of this system

    6. Mode of Communication

    7. Multithreading and Sockets

    8. Scalability

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    7/11

    is such that it may be deployed in other booking arenas (such as theatre tickets, online stores

    etc, simply by manipulating the database tables to list different products, and performing

    different linkedlist searches.

    Full source code is available on request.

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    8/11

    APPENDIX I

    Development Tools:

    Netbeans IDE 6.9.1, Sun Micro Systems.

    Access Database, Microsoft.

    Del Lattitude E5510, 2.27Ghz, 32bit. I3CPU.

    APPENDICES

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    9/11

    ticketClient Class Diagram

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    10/11

  • 7/28/2019 Simple Wireless Ad Hoc Distributed Network

    11/11

    ticketClient Class Diagram