Top Banner

of 74

Catching Stragies

Jun 03, 2018

Download

Documents

uthrasiva
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/12/2019 Catching Stragies

    1/74

    CACHING STRATEGIES BASED ON INFORMATION

    DENSITY ESTIMATION IN WIRELESS AD HOC

    NETWORKS

    A PROJECT REPORT

    Submitted by

    C.Vinoth Kum!

    C.P!"hu

    A.Hu##inin $!ti% &u%&i%%m'nt &o! th' (!) o& th' )'*!''

    o&

    BACHELOR OF ENGINEERING

    IN

    COMP+TER SCIENCE AND ENGINEERING

    SETH+ INSTIT+TE OF TECHNOLOGY

    P+LLOOR, KARIAPATTI-/01.

    ANNA +NIVERSITY2 CHENNAI 11 1/3.

    APRIL /10/

    1

  • 8/12/2019 Catching Stragies

    2/74

    SETH+ INSTIT+TE OF TECHNOLOGY

    P+LLOOR, KARIAPATTI-/ 01.

    ANNA +NIVERSITY2 CHENNAI 11 1/3.

    BONAFIDE CERTIFICATE

    Certified that this project report 4 Mu%ti$%' P56't# T!n#&'!!in* In

    Wi!'%'## N't(o!6# is the bonafide work of C.VINOTH K+MAR n)

    C.PRABH+ n) A.H+SSIAN who carried out the project work under my

    supervision.

    .

    2

    SIGNAT+RE

    S+PERVISOR

    SIGNAT+RE

    HEAD OF THE DEPARTMENT

  • 8/12/2019 Catching Stragies

    3/74

    CERTIFICATE FROM THE IND+STRIES

    A"out A$t'5h

    Aptech is a global learning company involved in multiple areas of education &with training centres spread across 5 continents.

    Aptech...

    ...is the First ! education & training company in Asia to receive the "#

    $%%' (%%% )uality certification

    ...is ranked the *o. ! education provider in China through +Aptech ,eida

    -ade ,ird China/

    ...is the *o. ! training company in countries like 0ietnam *igeria ran

    and so on

    ...has a dedicated arm 1 Aptech 2earning "ervices1 for developing useful &

    comprehensive content for each of its courses

    A"out A$t'5h Com$ut'! E)u5tion

    ((1year1old Aptech Computer 3ducation provides world1class ! training across

    the world.

    !hrough its global network of centers Aptech has so far turned 5 million students

    into successful professionals.

    Aptech alumni are employed as 4rogrammers !echnical support atabase

    administrators !echnical writers ata analysts & "ystem administrators with

    leading ! companies.

    n ndia Aptech offers various career1building programs to students. f you have

    completed Class ( or are a graduate these programs can enable you to get a great

    ! career.

    ACKNOWLEDGEMENT

    3

    http://www.aptechlearningservices.com/http://www.aptechlearningservices.com/
  • 8/12/2019 Catching Stragies

    4/74

    First we would like to thank GODthe almighty for giving us the talent

    and opportunity to complete our project and our ,.3 deree.

    6e wish to e7press our earned great fullness to our 8onourable

    Founder and Chairman M!. S. Mohmm') J%''% B.S.57 B.L7 for his

    encouragement e7tended to us to undertake this project work.

    6e would like to thank and e7press our gratitude to our 4rincipal

    D!. A. S'nthi% Kum! B.E7 M.E7 Ph.D7 for providing all necessary facilities for

    the completion of the project.

    6e wish like to thank and e7press our gratitude to our Chief

    37ecutive #fficer M!. S. M. S''ni Mohi)''n B.Com7 M.B.A7 irector1

    Administration M!#.S.M. Ni%o&'! Fthim B.E.7and irector1 9 & M#.S. M.

    N8i Fthim B.T'5h7 and -oint Chief 37ecutive #fficer :r.S.M. S''ni

    Mohmm') A%i! M!i669! B.E; for their support to this project work.

    6e wish to e7press our profound gratitude to our 8ead of the

    epartment P!o&. D!. J. Su)h for ranting us the necessary permission to proceed

    with our project.

    6e are immensely grateful to our guide supervisor and overseer

    M!#. P.K!i#hn:'ni ME., a lot throughout the course of the project. 6e render

    our sincere thanks for his great support in completing this project successfully.

    6e thank our P!'nt#, F5u%t9, M'm"'!#, Su$$o!tin* #t&&and

    F!i'n)#for their help e7tended during these times.

    4

  • 8/12/2019 Catching Stragies

    5/74

    ABSTRACT

    ata caching strategy for ad hoc networks whose nodes e7change information items in a

    peer1to1peer fashion. ata caching is a fully distributed scheme where each node upon receiving

    re)uested information determines the cache drop time of the information or which content to

    replace to make room for the newly arrived information. !hese decisions are made depending on

    the perceived presence< of the content in the nodes pro7imity whose estimation does not cause

    any additional overhead to the information sharing system.

    6e devise a strategy where nodes independent of each other decide whether to cache

    some content and for how long. n the case of small1si=ed caches we aim to design a content

    replacement strategy that allows nodes to successfully store newly received information while

    maintaining the good performance of the content distribution system. >nder both conditions

    each node takes decisions according to its perception of what nearby users may store in their

    caches and with the aim of differentiating its own cache content from the other nodes?.

    !he result is the creation of content diversity within the nodes neighborhood so that a

    re)uesting user likely finds the desired information nearby. 6e simulate our caching algorithms

    in different ad hoc network scenarios and compare them with other caching schemes showingthat our solution succeeds in creating the desired content diversity thus leading to a resource1

    efficient information access.

    5

  • 8/12/2019 Catching Stragies

    6/74

    TABLE OF CONTENTS

    Ch$t'! No Tit%' P*' No

    0. Int!o)u5tion

    ntroduction About !he #rgani=ation0

    ntroduction About !he 4roject@"ystem/

    9eview #f 2iterature;

    oal #f 4resent 6ork

    3/. D'&inin* Th' P!o"%'m

    37isting "ystem

    *eed For !he *ew "ystem. R'?ui!'m'nt S$'5i&i5tion8ardware "pecification

    @

    "oftware "pecification01

    "oftware -ustification 00

    6

  • 8/12/2019 Catching Stragies

    7/74

    ;. S9#t'm D'#i*n

    Conceptual esign>1

    etailed esign >0

    >ml iagrams>>

    3.S9#t'm Im$%'m'nttion

    >=

    . S9#t'm T'#tin*

    >nit !esting;0

    ntegration !esting ;/

    Functional !esting;>

  • 8/12/2019 Catching Stragies

    8/74

    LIST OF FIG+RES

    Fi*u!' No Fi*u!' Tit%' P*' No

    8

  • 8/12/2019 Catching Stragies

    9/74

    LIST OF ABBREVIATIONS

    NAMES ABBREVIATION

    9

  • 8/12/2019 Catching Stragies

    10/74

    0. INTROD+CTION

    0.0 INTROD+CTION ABO+T THE ORGANISATION

    Founded in$$B 4acific ,lue !echnologies 4vt. 2td is a consulting and software

    development firm dedicated to business success through long1term relationship with our clients

    and staff. ,ased in Chennai 4acific ,lue !echnologies has grown from a one1person startup to a

    significant corporation of 5%% talented professionals having more than % branches all over the

    world.

    4acific ,lue !echnologies is dynamic service oriented enterprise and is positioned

    to successfully respond to trends and changes in the information technology in the industry.

    4acific ,lue !echnology?s client relationships are based on the highest )uality professional

    technology consulting and development services. 4acific ,lue !echnologies enjoys and

    e7cellent reputation as a proven resource for strategic planning needs assessment client@server

    programming and interactive multimedia internet@intranet development networking and

    security services. 6ith customer in private business and the public sector takes pride in a history

    of projects that significantly enhance and @or improve client?s business practices and level of

    service.

    4acific ,lue !echnologies focus on long term relationship with staff is reflected through

    clear communication of e7pectation performance based recognition and advancement and an

    environment that supports employee?s professional development. 4acific ,lue !echnology?s

    staff comprised almost entirely of full time company employees is held to standards of

    accountability integrity creativity and competence. !he dedication skills and integrity of

    4acific ,lue !echnology?s staff are key to the firm?s success.

    10

  • 8/12/2019 Catching Stragies

    11/74

    0./ INTROD+CTION ABO+T THE PROJECTSYSTEM

    Ad hoc networks are multi hop wireless networks of small computing devices with

    wireless interfaces. !he computing devices could be conventional computers for e7ample 4Alaptop or 4CD or backbone routing platforms or even embedded processors such as sensor nodes.

    !he problem of optimal placement of caches to reduce overall cost of accessing data is motivated

    by the following two defining characteristics of ad hoc networks. First the ad hoc networks are

    multi hop networks without a central base station. !hus remote access of information typically

    occurs via multi hop routing which can greatly benefit from caching to reduce access latency.

    "econd the network is generally resource constrained in terms of channel bandwidth or battery

    power in the nodes. Caching helps in reducing communication this results in savings in

    bandwidth as well as battery energy. !he problem of cache placement is particularly challenging

    when each network node has a limited memory to cache data items.

    n this paper our focus is on developing efficient caching techni)ues in ad hoc networks

    with memory limitations. 9esearch into data storage access and dissemination techni)ues in ad

    hoc networks is not new. n particular these mechanisms have been investigated in connection

    with sensor networking peer1to1peer networks mesh networks world wide 6eb and even more

    general ad hoc networks. 8owever the presented approaches have so far been somewhat ad

    hoc< and empirically based without any strong analytical foundation. n contrast the theory

    literature abounds in analytical studies into the optimality properties of caching and replica

    allocation problems. 8owever distributed implementations of these techni)ues and their

    performances in comple7 network settings have not been investigated. t is even unclear whether

    these techni)ues are amenable to efficient distributed implementations.

    #ur goal in this paper is to develop an approach that is both analytically tractable with a

    provable performance bound in a centrali=ed setting and is also amenable to a natural distributed

    implementation. n our network model there are multiple data items; each data item has a server

    and a set of clients that wish to access the data item at a given fre)uency. 3ach node carefully

    chooses data items to cache in its limited memory to minimi=e the overall access cost.

    3ssentially in this article we develop efficient strategies to select data items to cache at each

    node. n particular we develop two algorithmsEa centrali=ed appro7imation algorithm which

    delivers a 1appro7imation (1appro7imation for uniform si=e data itemsD solution and a

    locali=ed distributed algorithm which is based on the appro7imation algorithm and can handle

    11

  • 8/12/2019 Catching Stragies

    12/74

    mobility of nodes and dynamic traffic conditions. >sing simulations we show that the

    distributed algorithm performs very close to the appro7imation algorithm. Finally we show

    through e7tensive e7periments on ns( that our proposed distributed algorithm performs much

    better than a prior approach over a broad range of parameter values. #urs is the first work to

    present a distributed implementation based on an appro7imation algorithm for the general

    problem of cache placement of multiple data items under memory constraint.

    ata caching strategy for ad hoc networks whose nodes e7change information items in a

    peer1to1peer fashion. ata caching is a fully distributed scheme where each node upon receiving

    re)uested information determines the cache drop time of the information or which content to

    replace to make room for the newly arrived information. !hese decisions are made depending on

    the perceived presence< of the content in the nodes pro7imity whose estimation does not cause

    any additional overhead to the information sharing system.

    6e devise a strategy where nodes independent of each other decide whether to cache

    some content and for how long. n the case of small1si=ed caches we aim to design a content

    replacement strategy that allows nodes to successfully store newly received information while

    maintaining the good performance of the content distribution system. >nder both conditions

    each node takes decisions according to its perception of what nearby users may store in their

    caches and with the aim of differentiating its own cache content from the other nodes?. !he result

    is the creation of content diversity within the nodes neighborhood so that a re)uesting user likely

    finds the desired information nearby. 6e simulate our caching algorithms in different ad hoc

    network scenarios and compare them with other caching schemes showing that our solution

    succeeds in creating the desired content diversity thus leading to a resource1efficient information

    access.

    12

  • 8/12/2019 Catching Stragies

    13/74

    0.> REVIEW OF LITERAT+RE

    2iteraturesurveyis the most important step in software development process. ,efore developing

    the tool it is necessary to determine the time factor economy n company strength. #nce these

    things r satisfied ten ne7t steps are to determine which operating system and language can be

    used for developing the tool. #nce theprogrammersstart building the tool the programmers need

    lot of e7ternal support. !his support can be obtained from senior programmers from bookor

    from websites. ,efore building the system the above consideration r taken into account for

    developing the proposed system.

    OVERVIEW2

    6e propose called 8amlet aims at creating content diversity within the node neighborhood so

    that users likely find a copy of the different information items nearby

    9egardless of the content popularity levelD and avoid flooding the network with )uery messages.

    Although a similar concept has been put forward in the novelty in our proposal resides in the

    probabilistic estimate run by each node of the information presence i.e. of the cached contentD

    in the node pro7imity. !he estimate is performed in a cross1layer fashion by overhearing content

    )uery and information reply messages due to the broadcast nature of the wireless channel. ,y

    leveraging such a local estimate nodes autonomously decide what information to keep and for

    how long resulting in a distributed scheme that does not re)uire additional control messages.

    13

    http://www.blurtit.com/q876299.htmlhttp://www.blurtit.com/q876299.htmlhttp://www.blurtit.com/q876299.htmlhttp://www.blurtit.com/q876299.htmlhttp://www.blurtit.com/q876299.htmlhttp://www.blurtit.com/q876299.htmlhttp://www.blurtit.com/q876299.htmlhttp://www.blurtit.com/q876299.html
  • 8/12/2019 Catching Stragies

    14/74

    Th' Hm%'t $$!o5h $$%i'# to th' &o%%o(in* 5#'#.

    G 2arge1si=ed caches

    n this case nodes can potentially store a large portion i.e. up to 5%HD of the available

    information items. 9educed memory usage is a desirable if not re)uiredD condition because the

    same memory may be shared by different services and applications that run at nodes. n such a

    scenario a caching decision consists of computing for how long a given content should be stored

    by a node that has previously re)uested it with the goal of minimi=ing the memory usage

    without affecting the overall information retrieval performance;

    G "mall1si=ed caches

    n this case nodes have a dedicated but limited amount of memory where to store a small

    percentage i.e. up to %HD of the data that they retrieve. !he caching decision translates into a

    cache replacement strategy that selects the information items to be dropped among the

    information items just received and the information items that already fill up the dedicated

    memory. 6e evaluate the performance of 8amlet in different mobile network scenarios where

    nodes communicate through ad hoc connectivity. !he results show that our solution ensures a

    high )uery resolution ratio while maintaining the traffic load very low even for scarcely popular

    content and consistently along different network connectivity and mobility scenarios.

    14

  • 8/12/2019 Catching Stragies

    15/74

    0.; GOAL OF PRESENT WORK

    #ur goal in this paper is to develop an approach that is both analytically tractable with a

    provable performance bound in a centrali=ed setting and is also amenable to a natural distributed

    implementation. n our network model there are multiple data items; each data item has a server

    and a set of clients that wish to access the data item at a given fre)uency. 3ach node carefully

    chooses data items to cache in its limited memory to minimi=e the overall access cost.

    3ssentially in this article we develop efficient strategies to select data items to cache at each

    node. n particular we develop two algorithmsEa centrali=ed appro7imation algorithm which

    delivers a 1appro7imation (1appro7imation for uniform si=e data itemsD solution and a

    locali=ed distributed algorithm which is based on the appro7imation algorithm and can handle

    mobility of nodes and dynamic traffic conditions. >sing simulations we show that the

    distributed algorithm performs very close to the appro7imation algorithm. Finally we show

    through e7tensive e7periments on ns( that our proposed distributed algorithm performs much

    better than a prior approach over a broad range of parameter values. #urs is the first work to

    present a distributed implementation based on an appro7imation algorithm for the general

    problem of cache placement of multiple data items under memory constraint.

    ata caching strategy for ad hoc networks whose nodes e7change information items in a

    peer1to1peer fashion. ata caching is a fully distributed scheme where each node upon receiving

    re)uested information determines the cache drop time of the information or which content to

    replace to make room for the newly arrived information. !hese decisions are made depending on

    the perceived presence< of the content in the nodes pro7imity whose estimation does not cause

    any additional overhead to the information sharing system.

    15

  • 8/12/2019 Catching Stragies

    16/74

    /. DEFINING THE PROBLEM

    /.0 EISTING SYSTEM

    37isting cooperative caching schemes for the 6eb environment can be classified asmessage1based directory1based hash based or router1based.

    !he cache array routing protocol is the most notable hash based cooperative caching

    protocol. !he rationale behind CA94 constitutes load distribution by hash routing among

    6eb pro7y cache arrays.

    A mobile node doesn?t know whether the data source or some other nodes serve its

    re)uest. f multiple data sources e7ist or if the mobile node doesn?t know where the data

    source is 8ybrid Cache might not be a good option.

    n addition caching nodes outside the path between the re)uesting node and the data

    source might not be able to share cache information with the re)uesting node.

    LIMITATIONS OF EISTING SYSTEM2

    37isting cooperative caching schemes for the 6eb environment can be classified as

    message1based directory1based hash based or router1based.

    !he cache array routing protocol is the most notable hash based cooperative caching

    protocol. !he rationale behind CA94 constitutes load distribution by hash routing among

    6eb pro7y cache arrays.

    16

  • 8/12/2019 Catching Stragies

    17/74

    /./ NEED FOR THE NEW SYSTEM2

    6e simulate our caching algorithms in different ad hoc network scenarios and compare

    them with other caching schemes showing that our solution succeeds in creating the

    desired content diversity thus leading to a resource1efficient information access.

    ata caching strategy for ad hoc networks whose nodes e7change information items in a

    peer1to1peer fashion. !hese decisions are made depending on the perceived presence< of

    the content in the nodes pro7imity whose estimation does not cause any additional

    overhead to the information sharing system.

    8owever the solution that was proposed is based on the formation of an overlay network

    composed of mediator< nodes and it is only fitted to static connected networks with

    stable links among nodes.

    6e proposes a complete framework for information retrieval and caching in mobile ad

    hoc networks and it is built on an underlying routing protocol and re)uires the manual

    setting of a network wide Caching =one< !hese assumptions along with the significant

    communication overhead needed to elect mediator< nodes make this scheme unsuitablefor the mobile environments.

    ADVANTAGES OF PROPOSED SYSTEM

    ata caching can significantly improve the efficiency of information access in a

    wireless ad hoc network by reducing the access latency and bandwidth usage.

    ata for information retrieval and caching in mobile ad hoc networks and it is

    built on an underlying routing protocol and re)uires the manual setting of a network wide

    Caching =one

  • 8/12/2019 Catching Stragies

    18/74

    /.> PROBLEM DEFINITION

    :obile environment can be classified as message1based directory1based hash based or

    router1based data source is 8ybrid Cache might not be a good option.

    !he cache array routing protocol is the most notable hash based cooperative caching

    protocol.

    ata caching strategy for ad hoc networks whose nodes e7change information items in a

    peer1to1peer fashion.

    ata caching is a fully distributed scheme where each node upon receiving re)uested

    information determines the cache drop time of the information or which content to

    replace to make room for the newly arrived information.

    !hese decisions are made depending on the perceived presence< of the content in the

    nodes pro7imity whose estimation does not cause any additional overhead to the

    information sharing system.

    18

  • 8/12/2019 Catching Stragies

    19/74

    >. RE+IREMENT SPECIFICATION

    >.0 HARDWARE SPECIFICATION

    !he above 8ardware specifications were used in both "erver and Client machines when

    developing.

    4rocessor ' 4entium

    4rocessor "peed ' (.5 h=

    9am ' 5( :,

    8ard isk rive ' B%,

    Floppy isk rive ' "ony

    C19#: rive ' "ony

    :onitor ' I< inches

    Jeyboard ' !0" old

    :ouse ' 2ogitech

    19

  • 8/12/2019 Catching Stragies

    20/74

    >./ SOFTWARE SPECIFICATION

    #perating "ystem ' 6indows K4 4rofessional

    !echnology >sed ' -J L.%

    !ools ' 3clipse M.M

    6eb "erver ' nternet nformation "erver

    ,rowser ' nternet 37plorer L.%

    20

  • 8/12/2019 Catching Stragies

    21/74

    >.> SOFTWARE J+STIFICATION

    JAVA TECHNOLOGY2

    -ava technology is both a programming language and a platform.

    Th' J: P!o*!mmin* Ln*u*'

    !he -ava programming language is a high1level language that can be characteri=ed by all

    of the following bu==words'

    "imple

    Architecture neutral

    #bject oriented

    4ortable

    istributed

    8igh performance

    nterpreted

    :ultithreaded

    9obust

    ynamic

    "ecure

    6ith most programming languages you either compile or interpret a program so that you can

    run it on your computer. !he -ava programming language is unusual in that a program is both

    compiled and interpreted. 6ith the compiler first you translate a program into an intermediate

    language calledJava byte codesEthe platform1independent codes interpreted by the interpreter

    on the -ava platform. !he interpreter parses and runs each -ava byte code instruction on the

    computer. Compilation happens just once; interpretation occurs each time the program is

    e7ecuted. !he following figure illustrates how this works.

    21

  • 8/12/2019 Catching Stragies

    22/74

    Nou can think of -ava byte codes as the machine code instructions for the Java Virtual

    Machine-ava 0:D. 3very -ava interpreter whether it?s a development tool or a 6eb browser

    that can run applets is an implementation of the -ava 0:. -ava byte codes help make write

    once run anywhere< possible. Nou can compile your program into byte codes on any platform

    that has a -ava compiler. !he byte codes can then be run on any implementation of the -ava 0:.

    !hat means that as long as a computer has a -ava 0: the same program written in the -ava

    programming language can run on 6indows (%%% a "olaris workstation or on an i:ac.

    Th' J: P%t&o!m

    A platformis the hardware or software environment in which a program runs. 6e?ve already

    mentioned some of the most popular platforms like 6indows (%%% 2inu7 "olaris and :ac#".

    :ost platforms can be described as a combination of the operating system and hardware. !he

    -ava platform differs from most other platforms in that it?s a software1only platform that runs on

    top of other hardware1based platforms.

    !he -ava platform has two components'

    !he J: Vi!tu% M5hin'-ava 0:D

    !he J: A$$%i5tion P!o*!mmin* Int'!&5'-ava A4D

    Nou?ve already been introduced to the -ava 0:. t?s the base for the -ava platform and is ported

    onto various hardware1based platforms.

    22

  • 8/12/2019 Catching Stragies

    23/74

    !he -ava A4 is a large collection of ready1made software components that provide many useful

    capabilities such as graphical user interface >D widgets. !he -ava A4 is grouped into

    libraries of related classes and interfaces; these libraries are known aspackages.

    !he ne7t section 6hat Can -ava !echnology oO 8ighlights what functionality some of the

    packages in the -ava A4 provide.

    !he following figure depicts a program that?s running on the -ava platform. As the figure shows

    the -ava A4 and the virtual machine insulate the program from the hardware.

    *ative code is code that after you compile it the compiled code runs on a specific hardware

    platform. As a platform1independent environment the -ava platform can be a bit slower than

    native code. 8owever smart compilers well1tuned interpreters and just1in1time byte code

    compilers can bring performance close to that of native code without threatening portability.

    6hat Can -ava !echnology oO

    !he most common types of programs written in the -ava programming language are applets and

    applications. f you?ve surfed the 6eb you?re probably already familiar with applets. An applet

    is a program that adheres to certain conventions that allow it to run within a -ava1enabled

    browser.

    8owever the -ava programming language is not just for writing cute entertaining applets for the

    6eb. !he general1purpose high1level -ava programming language is also a powerful software

    platform. >sing the generous A4 you can write many types of programs.

    An application is a standalone program that runs directly on the -ava platform. A special kind of

    application known as a server serves and supports clients on a network. 37amples of servers are

    6eb servers pro7y servers mail servers and print servers. Another speciali=ed program is a

    servlet. A servlet can almost be thought of as an applet that runs on the server side. -ava "ervlets

    are a popular choice for building interactive web applications replacing the use of C scripts.

    "ervlets are similar to applets in that they are runtime e7tensions of applications. nstead of

    working in browsers though servlets run within -ava 6eb servers configuring or tailoring the

    server.

    8ow does the A4 support all these kinds of programsO t does so with packages of software

    components that provides a wide range of functionality. 3very full implementation of the -ava

    platform gives you the following features'

    23

  • 8/12/2019 Catching Stragies

    24/74

    1. Th' '##'nti%#' #bjects strings threads numbers input and output data structures

    system properties date and time and so on.

    2. A$$%'t#' !he set of conventions used by applets.

    3. N't(o!6in*' >92s !C4 !ransmission Control 4rotocolD >4 >ser ata gram

    4rotocolD sockets and 4 nternet 4rotocolD addresses.

    4. Int'!ntion%i8tion' 8elp for writing programs that can be locali=ed for users

    worldwide. 4rograms can automatically adapt to specific locales and be displayed in

    the appropriate language.

    5. S'5u!it9' ,oth low level and high level including electronic signatures public and

    private key management access control and certificates.

    6. So&t(!' 5om$on'nt#' Jnown as -ava,eans!: can plug into e7isting component

    architectures.

    7. O"'5t #'!i%i8tion' Allows lightweight persistence and communication via 9emote

    :ethod nvocation 9:D.

    8. J: Dt"#' Conn'5ti:it9 JDBCTM' 4rovides uniform access to a wide range of

    relational databases.

    !he -ava platform also has A4s for ( and M graphics accessibility servers collaboration

    telephony speech animation and more. !he following figure depicts what is included in the

    -ava ( "J.

    8ow 6ill -ava !echnology Change :y 2ifeO

    6e can?t promise you fame fortune or even a job if you learn the -ava programming language.

    "till it is likely to make your programs better and re)uires less effort than other languages. 6e

    believe that -ava technology will help you do the following'

    24

  • 8/12/2019 Catching Stragies

    25/74

    1. G't #t!t') ?ui56%9' Although the -ava programming language is a powerful object1

    oriented language it?s easy to learn especially for programmers already familiar with C

    or CPP.

    2. W!it' %'## 5o)'' Comparisons of program metrics class counts method counts and so

    onD suggest that a program written in the -ava programming language can be four times

    smaller than the same program in CPP.

    3. W!it' "'tt'! 5o)'' !he -ava programming language encourages good coding practices

    and its garbage collection helps you avoid memory leaks. ts object orientation its

    -ava,eans component architecture and its wide1ranging easily e7tendible A4 let you

    reuse other people?s tested code and introduce fewer bugs.

    4. D':'%o$ $!o*!m# mo!' ?ui56%9' Nour development time may be as much as twice as

    fast versus writing the same program in CPP. 6hyO Nou write fewer lines of code and it

    is a simpler programming language than CPP.

    5. A:oi) $%t&o!m )'$'n)'n5i'# (ith 011 Pu!' J:' Nou can keep your program

    portable by avoiding the use of libraries written in other languages. !he %%H 4ure

    -ava!: 4roduct Certification 4rogram has a repository of historical process manuals

    white papers brochures and similar materials online.

    6. W!it' on5', !un n9(h'!'' ,ecause %%H 4ure -ava programs are compiled into

    machine1independent byte codes they run consistently on any -ava platform.

    7. Di#t!i"ut' #o&t(!' mo!' '#i%9' Nou can upgrade applets easily from a central server.

    Applets take advantage of the feature of allowing new classes to be loaded on the fly4 is used. !wo processes wishing to communicate over a

    network create a socket each. !hese are similar to two ends of a pipe 1 but the actual pipe does

    not yet e7ist.

    JF!'' Ch!t

    -FreeChart is a free %%H -ava chart library that makes it easy for developers to display

    professional )uality charts in their applications. -FreeChart/s e7tensive feature set includes'

    A consistent and well1documented A4 supporting a wide range of chart types;

    A fle7ible design that is easy to e7tend and targets both server1side and client1side applications;

    32

  • 8/12/2019 Catching Stragies

    33/74

    "upport for many output types including "wing components image files including 4* and

    -43D and vector graphics file formats including 4F 34" and "0D;

    -FreeChart is Sopen sourceS or more specifically free software. t is distributed under the terms

    of the *> 2esser eneral 4ublic 2icence 242D which permits use in proprietary

    applications.

    0. M$ Vi#u%i8tion#

    Charts showing values that relate to geographical areas. "ome e7amples include' aD

    population density in each state of the >nited "tates bD income per capita for each country in

    3urope cD life e7pectancy in each country of the world. !he tasks in this project include'

    "ourcing freely redistributable vector outlines for the countries of the world states@provinces in

    particular countries >"A in particular but also other areasD;

    Creating an appropriate dataset interface plus default implementationD a rendered and

    integrating this with the e7isting KN4lot class in -FreeChart; !esting documenting testing some

    more documenting some more.

    /. Tim' S'!i'# Ch!t Int'!5ti:it9

    mplement a new to -FreeChartD feature for interactive time series charts 111 to display a

    separate control that shows a small version of A22 the time series data with a sliding SviewS

    rectangle that allows you to select the subset of the time series data to display in the main chart.

    >. D#h"o!)#

    !here is currently a lot of interest in dashboard displays. Create a fle7ible dashboard

    mechanism that supports a subset of -FreeChart chart types dials pies thermometers bars and

    lines@time seriesD that can be delivered easily via both -ava 6eb "tart and an applet.

    ;. P!o$'!t9 E)ito!#

    !he property editor mechanism in -FreeChart only handles a small subset of the

    properties that can be set for charts. 37tend or reimplementD this mechanism to provide greater

    end1user control over the appearance of the charts.

    33

    http://www.gnu.org/philosophy/free-sw.htmlhttp://www.gnu.org/licenses/lgpl.htmlhttp://www.gnu.org/philosophy/free-sw.htmlhttp://www.gnu.org/licenses/lgpl.html
  • 8/12/2019 Catching Stragies

    34/74

    . SYSTEM DESIGN

    ;.0 CONCEPT+AL DESIGN

    A !" #$! J#I% I &'! !&"#()

    34

  • 8/12/2019 Catching Stragies

    35/74

    !I*'+#(% (!%P#%! A$$(!%% A%%I*

    35

  • 8/12/2019 Catching Stragies

    36/74

    ;./ DETAILED DESIGN

    0 :ost people talk about detailed design they are referring to a process known as top1

    down design. n short when you think about the problem you are trying to solve you start at the

    highest level and then work yourself into the details. !his approach works very well when you

    have an overall structure you want your application to live within. At the macro level you are

    considering how many machines will be needed to host your application which e7isting services

    you will need to use etc. As you dive deeper you are looking at use cases or user stories if you

    prefer that terminologyD and error handling use cases have both normal and error condition

    paths to worry aboutD. As you go even further into the details you are looking at your algorithm

    state transitions logical se)uence and how internal parts of the code work together.

    / !he classic top1down approach to detailed design is what is taught with the SwaterfallS

    methodology 333 process guides >:2 vendors universities and C:: among others. n

    many of these heavy processes they have you writing two design documents. #ne is the overall

    architectural diagram the top level designD. !he other is the detailed design where you go further

    down the rabbit hole. n many cases it is the only approach to design many people know. t is a

    very logical and methodical approach to breaking down a software problem.

    > !he main advantage is that you have identified what the critical sections are likely going

    to be. f you will need to start working on how your software will be using another e7isting

    service you have compiled your list of integration points. Nou would be able to start talks with

    the owners of those services to plan your integration along with how to handle une7pected

    events.

    !he main disadvantage is that many times people go too far down the rabit hole and the design

    document takes a life of its own. 6hile it is advantageous to have an overall vision andarchitecture for how an application will work you will invariably find your initial thoughts on

    the core details were flat wrong. 6hen that happens either the design document is neglected or

    you have whole teams maintaining the paper and slowing progress on work.

    36

  • 8/12/2019 Catching Stragies

    37/74

    ; /ve already mentioned top1down design so it follows there must be a Sbottom1upS

    approach rightO As it turns out there is. 3ssentially the Sbottom1upS approach is the core

    thought process behind !est riven evelopment and Continuous esign methodologies.

    3ssentially the details of working code start driving the design of how larger chunks of working

    code cooperate and interface with each other. 6ith ! you have unit tests to ensure that the

    details behave properly and keep validating your design. Continuous design teaches us that we

    will never truly know the details until the software is done. !herefore why try to fight the factO

    nstead of a big up1front design stage the design is built in increments over several iterations of

    design@code and testing. t is actually a very liberating concept that lets you concentrate on

    solving problems.

    ,ottom line there is no perfect answer. For me find a healthy balance between top1

    down and bottom1up design works well. 3ssentially still take the time to think about the big

    picture. even map out a plan for the user interface idioms and my best ideas for it/s design.

    8owever don/t go into great detail because know the details will change. ,asically you need

    to stop the top1down process when you are getting to areas you are not sure about. #nce you get

    to those areas start with the bottom1up approach. !his lets you try different things verify with

    the customer if it makes sense to them and continue to improve over time.

    37

  • 8/12/2019 Catching Stragies

    38/74

    ;.> +ML DIAGRAMS

    ,%! CA%! $IA*(AM%-

    38

  • 8/12/2019 Catching Stragies

    39/74

    C.A%% $IA*(AM%-

    39

    Networ

    !ender

    "dd nodes

    Node #reation

    Nodes in $ell

    %ata #a$hing

    !tart mo&ilit'

    (efresh nodes

    #a$hing )ath

    "d*a$ent Nodes

    +otal Nodes

    ,et !hortest

    ,et #ahing Nodes)ath differen$e

  • 8/12/2019 Catching Stragies

    40/74

    e/ no0e

    -

    et/or1

    -

    Parent

    -

    -nter the networ

    .ind the parent

    (eturn parent

    node position

    "tta$h as $hild node

    (eorgani/e the networ

    #al$ulate new address

    0pdate routing

    ta&les

    (eturn address

    and routing ta&le

    %!,!C! $IA*(AM%-

    40

  • 8/12/2019 Catching Stragies

    41/74

    AC&II& $IA*(AM%-

    41

  • 8/12/2019 Catching Stragies

    42/74

    $A&A.#" $IA*(AM-

    Dt F%o( Di*!m2 L':'%-1

    42

  • 8/12/2019 Catching Stragies

    43/74

    Dt F%o( Di*!m2 L':'%-0

    43

  • 8/12/2019 Catching Stragies

    44/74

    %ata low %iagram : evel 2

    44

  • 8/12/2019 Catching Stragies

    45/74

    Dt F%o( Di*!m 2L':'% >

    45

  • 8/12/2019 Catching Stragies

    46/74

    3. SYSTEM IMPLEMENTATION

    mplementation is the state in the system where the theoretical design is turned into a working

    system. !he most crucial stage in achieving a new successful system and in giving confidence

    on the new system for the users that will work efficiently and effectively. !he system can be

    implemented only after thorough testing in done and if found to work according to the

    specification.

    f involves careful planning investigation of the current system and its constraints on

    implementation design of methods to achieve the changeover an evaluation of changeover

    methods apart from planning. !wo major tasks of preparing the implementation are education

    training of the users and testing the systems. "ystem analysis and design efforts will be more for

    comple7 systems beings implemented. ,ased on policies of individuals organi=ation an

    implementation coordinating committee has been appointed.

    !he implementation process begins with preparing a plan for the implementation system.

    According to this plan the other activities are to be carried out. n this plan discussion has been

    made regarding the e)uipment resources and how to test the activities. !hus a clear plan ispreparing for the activities.

    E?ui$m'nt A5?ui#ition

    According to the above plan the necessary e)uipment has to be ac)uired to implement the

    new system. 4rime !ech has all the hardware re)uirements for installing and maintaining the

    package.

    P!o*!m 5o)' $!'$!tion

    #ne of the most important development activities is the code of programming. !he system

    F?s and other channels are converted to modular programs. !hey have to be complied

    tested and debugged.

    46

  • 8/12/2019 Catching Stragies

    47/74

    +#'! Mnu%#

    #nce planning has been completed the major effort of the computer department is to

    ensure that the user department consists of education and trained staff as the system becomesmore comple7. !he success of a system depends upon how they are operated and used. !hus the

    )uality of training the personnel is connected to the success of the system.

    For this purpose system and user manuals are prepared. n system manuals details about

    the forms and blocks triggers. 6hich were used to develop them were specified. n user

    manuals data flow diagrams charts and screen formats are given. Also error messages

    associated were e7plained in details. !he users were shown the success and they were taught

    how to operate the system. 2ive demonstration and visuals aids were used to teach them.

    LIST OF MOD+LES

    Mo)u%'#

    According to the analysis three modules has been traced out in the design of work. !he

    modules are as follows.

    0. SELF-ORGANIING

    /. SELF-ADDRESSING MANET

    >. INTEGRATED CACHE-RO+TING

    ;. LOCALIED CACHING POLICY

    3. DISTRIB+TED CACHING ALGORITHM

    47

  • 8/12/2019 Catching Stragies

    48/74

    MOD+LE DESCRIPTION2

    SELF-ORGANIING2

    :ultiple ata?s for cache placement of multiple data items in ad hoc networks. n the

    first approach each node caches the items most fre)uently accessed by itself; the second

    approach eliminates replications among neighboring nodes introduced by the first approach; the

    third approach re)uire one or more central< nodes to gather neighborhood information and

    determine caching placements. !he first two approaches are largely locali=ed and hence would

    fare very badly when the percentage of client nodes in the network is low or the access

    fre)uencies are uniform. n other related works discuss placement of transparent< caches in tree

    networks.

    SELF-ADDRESSING2

    A multi1hop ad hoc network can be represented as an undirected the nodes in the network

    andE are the set of weighted edges in the graph. !wo network nodes that can communicate

    directly with each other are connected by an edge in the graph. !he edge weight may represent a

    link metric such as loss rate delay or transmission power. For the cache placement problem

    addressed in this article there are multiple data items and each data item is served by its server a

    network node may act as a server for more than one data itemsD. 3ach network node has limited

    memory and can cache multiple data items subject to its memory capacity limitation. !he

    objective of our cache placement problem is to minimi=e the overall access cost. ,elow we give

    a formal definition of the cache placement problem addressed in this system.

    INTEGRATED CACHE-RO+TING2

    *earest1caching tables can be used in conjunction with any underlying routing protocol

    to reach the nearest cache node as long as the distances to other nodes are maintained by

    the routing protocol.

    8owever note that maintaining cache1routing tables instead of nearest1cache tables and

    routing tables doesn?t offer any clear advantage in terms of number of messages

    transmissions.

    48

  • 8/12/2019 Catching Stragies

    49/74

    6e could maintain the integrated cache1routing tables in the similar vein as routing tables

    are maintained in mobile ad hoc networks. Alternatively we could have the servers

    periodically broadcast the latest cache lists. n our simulations we adopted the latter

    strategy since it precludes the need to broadcast Add Cache and elete Cache messages

    to some e7tent.

    LOCALIED CACHING POLICY2

    !he caching policy of CA is as follows. 3ach node computes benefit of data items

    based on its local traffic< observed for a sufficiently long time. !he local traffic of a

    node i includes its own local data re)uests nonlocal data re)uests to data items cached at

    i and the traffic that the node i is forwarding to other nodes in the network.

    A node decides to cache the most beneficial in terms of local benefit per unit si=e of data

    itemD data items that can fit in its local memory. 6hen the local cache memory of a node

    is full the following cache replacement policy is used.

    n particular a data item is newly cached only if its local benefit is higher than the benefit

    threshold and a data item replaces a set of cached data items only if the difference in

    their local benefits is greater than the benefit threshold.

    DISTRIB+TED GREEDY ALGORITHM DCA2

    n this subsection we describe a locali=ed distributed implementation of CA. 6e refer

    to the designed distributed implementation as CA istributed Caching AlgorithmD. !he

    advantage of CA is that it adapts to dynamic traffic conditions and can be easily implemented

    in an operational possibly mobileD network with low communication overheads. 6hile we

    cannot prove any bound on the )uality of the solution produced by CA we show through

    e7tensive simulations that the performance of the CA.

    49

  • 8/12/2019 Catching Stragies

    50/74

    . SYSTEM TESTING

    !he important phase of software development is concerned with translating the design

    specification into the error1free source code. !esting is carried out to ensure that the system does

    not fail that it meets the specification and it satisfies the user. !he system testing was carried out

    in a systematic manner with a test data containing all possible combinations of data to check the

    features of the system. A test data was prepared for each module which took care of all the

    modules of the program.

    "ystem !esting is an important stage where the system developed is tested with duplicate

    or original data. t is a process of e7ecuting a program with the intent of finding an error. t is a

    critical process that can consume fifty percent of the development time.

    !he following are the attributes of good test '

    A good test has a high probability of finding an error.

    A good test is not redundant.

    A good test should be Sbest of breedS.

    A good test should be neither simple nor too comple7.

    0.0 +NIT TESTING

    n >nit !esting the functionality of each individual program unit is tested. "ample data is

    usually provided for unit testing. !he validations and the limitations of the program are tested.

    !he screens developed were checked for whether it works correctly for the inputs given.

    50

  • 8/12/2019 Catching Stragies

    51/74

    ./ INTEGRATION TESTING

    ntegration !esting is done using the bottom1up approach to integrate the software

    components into a functional product. !he bottom1up strategy consists of testing the entiresystem. !he interactions between the program units are tested and recorded.

    Careful planning and scheduling are re)uired to ensure that modules will be available for

    integration into the evolving software product when needed. !he integration strategy dictates the

    order in which modules must be available and thus e7erts a strong influence on the order in

    which modules are written debugged and unit tested.

    51

  • 8/12/2019 Catching Stragies

    52/74

  • 8/12/2019 Catching Stragies

    53/74

  • 8/12/2019 Catching Stragies

    54/74

  • 8/12/2019 Catching Stragies

    55/74

    =. APPENDICES

    SCREEN SHOT

    55

  • 8/12/2019 Catching Stragies

    56/74

    56

  • 8/12/2019 Catching Stragies

    57/74

    57

  • 8/12/2019 Catching Stragies

    58/74

    58

  • 8/12/2019 Catching Stragies

    59/74

    Sm$%' Co)'

    Simu%tion.:

    package action;

    import java.awt.,order2ayout;

    import java.awt.event.Action3vent;

    import java.awt.event.Action2istener;import java7.swing.-Frame;

    import java7.swing.-:enu;

    import java7.swing.-:enu,ar;

    import java7.swing.-:enutem;

    import java7.swing.-"plit4ane;

    import java7.swing.event.:enu3vent;

    import java7.swing.event.:enu2istener;

    public class "imulation e7tends -Frame implements Action2istener:enu2istener

    W

    private -:enu,ar bar;

    private -:enu file;

    private -:enutem e7it;

    private -:enutem send;

    public static 4aint4anel pp;

    public "imulationD

    W

    barXnew -:enu,arD;

    fileXnew -:enuSFileSD;

    file.set:nemonic/f/D;

    file.add:enu2istenerthisD;

    sendXnew -:enutemS"endSD;

    send.addAction2istenerthisD;send.setActionCommandSsendSD;

    59

  • 8/12/2019 Catching Stragies

    60/74

    send.set:nemonic/s/D;

    file.addsendD;

    e7itXnew -:enutemS37itSD;

    e7it.addAction2istenerthisD;

    e7it.setActionCommandS37itSD;

    e7it.set:nemonic/7/D;

    file.adde7itD;

    bar.addfileD;

    set-:enu,arbarD;

    ppXnew 4aint4anelD;

    set2ayoutnew ,order2ayoutDD;

    final -"plit4ane spt X new -"plit4ane-"plit4ane.039!CA2Y"42!trueD;

    spt.setivider2ocationM5%D;

    spt.set2eftComponentppD;

    set!itleS:A*3! "imulatorSD;

    addsptD;

    set0isibletrueD;

    setefaultClose#peration"4#"3Y#*YC2#"3D;

    set37tended"tate :AK:Z3Y,#!8D;

    [

    public static void main"tring args\]D

    W

    new "imulationD;

    [

    public void menu"elected:enu3vent eD

    W @@ !## Auto1generated method stub

    [

    public void menueselected:enu3vent eD

    W @@ !## Auto1generated method stub

    [

    public void menuCanceled:enu3vent eD

    W @@ !## Auto1generated method stub

    60

  • 8/12/2019 Catching Stragies

    61/74

    [

    public void action4erformedAction3vent eD

    W

    ife.get"ourceD.e)ualse7itDD

    W

    "ystem.e7it%D;

    [

    ife.get"ourceD.e)ualssendDD

    W

    new "enderFormD;

    [

    [

    [

    PintPn'%.:

    packageaction;

    importjava.awt.raphics(;

    importjava.awt.4oint;

    importjava.awt.Color;

    importjava.awt.raphics;

    importjava.awt.9endering8ints;

    importjava.awt.event.:ouse3vent;

    importjava.awt.event.:ouseAdapter;

    importjava.util.terator;

    importjava.util.0ector;

    importjava7.swing.-#ption4ane;

    importjava7.swing.-4anel;

    importjava.util.ate;

    publicclass4aint4anel e7tends-4anel

    W

    privateintpointCountX%;

    private4ointpoints\]Xnew4oint\%%%];

    "tringname;

    61

  • 8/12/2019 Catching Stragies

    62/74

    intiX%;

    inthostportX5%%%;

    atedXnewateD;

    publicstatic8ostContainer nt X new8ostContainerD;

    public4aint4anelD

    W

    add:ouse2istener

    new:ouseAdapterD

    W

    publicvoidmouseClicked:ouse3venteventD

    W

    ifiU5%D

    W

    longhostYidXnewateD.get!imeD;

    4ointpoint X event.get4ointD; @@et the

    4oint 4osition

    nameXS8ostS;

    iPP;

    nameXnameP"tring.value#fiD;

    hostportPP;

    @@Assign uni)ue port for every 8ost

    8ost node X new8ostpoint

    namehostporthostYidD; @@Create #bject and pass arguments through constructor

    nt.add8ostnodeD; @@Add object of 8ost

    class to 8ostContainer Class

    repaintD;

    [

    else

    W

    -#ption4ane.show:essageialognullSAllowed only 5% 9eceiver 8ostsSD;

    [

    [

    [

    62

  • 8/12/2019 Catching Stragies

    63/74

    D;

    [

    publicvoidpaintfinalraphicsgD

    W

    raphics( gg X raphics(D g;

    gg.set9endering8int9endering8ints.J3NYA*!A2A"*

    9endering8ints.0A2>3YA*!A2A"Y#*D;

    g.setColorColor.93D;

    gg.clear9ect% % get6idthD get8eightDD;

    teratortree!raverse X nt.getteratorD;

    0ectorv X nt.get0ectorD;

    whiletree!raverse.has*e7tDD

    W

    8ost host X 8ostD tree!raverse.ne7tD;

    gg.setColorColor.,2>3D;

    gg.fill#valhost.position.7 1 % host.position.y 1 % B BD;

    @@gg.drawmageget!oolkitD.getmageSApp.icoSD host.position.7 1 %

    host.position.y 1 % thisD;

    gg.setColorColor.,2ACJD;

    gg.draw"tringS\SPhost.name PS]S host.position.7 1 (%host.position.y P

    (%D;

    [

    [

    [

    63

  • 8/12/2019 Catching Stragies

    64/74

    T!n#&'!O"'5t.:

    packageaction;

    importjava.awt.4oint;

    importjava.io.File;

    importjava.io.Filenput"tream;

    importjava.io.File*otFound37ception;

    importjava.io.File#utput"tream;

    importjava.io.#37ception;

    importjava.util.terator;

    importjava.util.0ector;

    importjava7.swing.-#ption4ane;

    publicclass!ransfer#bject

    W

    private,uffer!ransfer buffer!ransfer;

    publicstatic!ransfer#bject transfer#bject;

    byte\] buffer;

    Filenput"treamfis;

    public!ransfer#bject"tringsname"tringdname"tringfname,uffer!ransfer

    buffer!ransferD throws37ception

    W

    this.buffer!ransferXbuffer!ransfer;

    transfer#bjectXnew!ransfer#bjectD;

    this.snameXsname;

    this.dnameXdname;

    this.fnameXfname;

    buffer!ransfer.set"ourceYnamesnameD; @@ "et "ouce *ame

    buffer!ransfer.setestinationYnamednameD; @@ "et estination name

    buffer!ransfer.setFilenamefnameD; @@ "et File *ame

    FilefXnewFilefnameD;

    tryW

    fis XnewFilenput"treamfD;

    bufferXnewbyte\fis.availableD];

    fis.readbufferD;

    [ catchFile*otFound37ceptioneD W

    64

  • 8/12/2019 Catching Stragies

    65/74

    @@ !## Auto1generated catch block

    e.print"tack!raceD;

    [ catch#37ceptioneD W

    @@ !## Auto1generated catch block

    e.print"tack!raceD;

    [

    buffer!ransfer.set,ufferbufferD;

    transfer#bject.neighbourYnodesnamednamefnamebuffer!ransferD;

    [

    public!ransfer#bjectD

    W[

    int

    destYavailYconfirmX%regionYshortYnodeX%sdtX%ne7tYsdtX%transYportX%transYportYcopyX%d

    estYreachYconfirmX%;

    "tringsnamednamefnametransYnodeYtypeXSS;

    4ointsYpointregYpoint; @@For get source point

    longtransYportYid; @@Assign port id for transfer

    0ectorcurrentYregYvectorXnew0ectorD; @@For set Current region 8ostFind out host

    (% istanceD

    0ectorcurrentYregYvectorYne7tXnew0ectorD; @@For set *e7t Current region

    8ostinclude (% istanceD

    "tringregionYshortYnodeYnameXS*oneS; @@ Assign *e7t 8ost for !ranverse

    @@ For declare value for ne7t iteration loop

    "tringnotYreachYalternateYhostXS*oneSnotYreachYalternateYhostYcopyXS*oneS;

    4ointnotYreachYalternateYhostYpoint X null;

    intnotYreachYhostport X %;

    intfdtX%;

    publicvoidneighbourYnode"tringsname"tringdname"tringfname,uffer!ransfer

    buffer!ransferD throws37ception

    W

    destYreachYconfirmX%;

    teratortree!raverse X 4aint4anel.nt.getteratorD; @@ teration for 8ost

    information

    65

  • 8/12/2019 Catching Stragies

    66/74

    whiletree!raverse.has*e7tDD @@Find out source and destination point

    W

    8ost host X 8ostD tree!raverse.ne7tD;

    ifhost.name.e)ualsgnoreCasesnameDD

    sYpointXhost.position; @@Assign "ource

    4osition

    [

    teratortree!raverseYdist X 4aint4anel.nt.getteratorD; @@terate all host from

    hostcontainer

    whiletree!raverseYdist.has*e7tDD

    W

    8ost host X 8ostD tree!raverseYdist.ne7tD; @@et 8ost list from

    8ostContainer Class

    sdt X intD:ath.s)rt:ath.powsYpoint.71host.position.7D (D P

    :ath.powsYpoint.y1host.position.yD (DD; @@Find the istance from "ource and iterate host

    ifsdtV%D && sdtUX(5D&& R

    buffer!ransfer.get9efuseYpacketYcontainerD.containshost.hostYidDD && R

    buffer!ransfer.getestinationYnotYreachableYlistD.containshost.nameDD&& R

    buffer!ransfer.getCrossingYhostYnameD.containshost.nameDDD @@Check

    particular 9egion

    W

    currentYregYvector.addhost.nameD;

    buffer!ransfer.set9efuseYhostYidhost.hostYidD;

    @@Code for Check *e7t iteration host are

    availablewithin ne7t (5 9egionD

    teratortree!raverseYdistYne7t X 4aint4anel.nt.getteratorD;

    whiletree!raverseYdistYne7t.has*e7tDD

    W

    8ost hostYne7t X 8ostD tree!raverseYdistYne7t.ne7tD;

    @@et 8ost list from 8ostContainer Class

    ne7tYsdt X intD:ath.s)rt:ath.powhost.position.71

    hostYne7t.position.7D (D P :ath.powhost.position.y1hostYne7t.position.yD (DD; @@Find the

    istance from "ource and iterate host

    66

  • 8/12/2019 Catching Stragies

    67/74

    ifne7tYsdtV%D&&ne7tYsdtUX(5D&& R

    buffer!ransfer.get9efuseYpacketYcontainerD.containshostYne7t.hostYidDD && R

    hostYne7t.name.e)ualssnameDD && R

    buffer!ransfer.getCrossingYhostYnameD.containshost.nameDDD @@Check

    particular 9egion

    W

    currentYregYvectorYne7t.addhostYne7t.nameD;

    [

    [ @@3nd for check *e7t iteration

    ifregionYshortYnodeUXsdtD &&

    currentYregYvectorYne7t.si=eDV%D^^host.name.e)ualsbuffer!ransfer.getestinationYnameDDDD

    && Rbuffer!ransfer.getCrossingYhostYnameD.containshost.nameDDD

    W

    regionYshortYnodeXsdt;

    regionYshortYnodeYnameXhost.name; @@Assign ne7t host

    destYreachYconfirmPP;

    transYportXhost.host4ort; @@get >ni)ue

    port for ne7t host

    [

    [

    currentYregYvectorYne7t.removeAllcurrentYregYvectorYne7tD;

    [

    ifcurrentYregYvector.containsdnameDD @@Check estinatin host are avaiable in

    9egion

    W

    -#ption4ane.show:essageialognullS"uccessfully sentSD;

    "tringfobXS8osts@SPdname;

    FilefXnewFilefobD;

    f.mkdirD; @@:ake irectory if not e7ists

    File#utput"treamfos;

    tryW

    fos X newFile#utput"treamfobPS@#utput.t7tSD; @@enrate the .t7t

    for output

    fos.writebuffer!ransfer.get,ufferDD; @@enerate output

    when File reach their estination

    67

  • 8/12/2019 Catching Stragies

    68/74

    fos.closeD;

    [ catchFile*otFound37ceptioneD W

    @@ !## Auto1generated catch block

    e.print"tack!raceD;

    [

    buffer!ransfer.setestinationYtypeSestinationSD;

    new"ub8ost9esponsetransYportbuffer!ransferD;

    [

    elseifRregionYshortYnodeYname.e)ualsS*oneSDD @@Assign for ne7t 8ost to

    !raverse

    W

    currentYregYvector.removeAllcurrentYregYvectorD;

    regionYshortYnodeX%;

    sdtX%;

    buffer!ransfer.setCurrentYhostregionYshortYnodeYnameD;

    buffer!ransfer.setCrossYhostYnameregionYshortYnodeYnameD;

    "ystem.out.printlnS*e7t 8ost to 4rocess11

    VSPbuffer!ransfer.getCurrentYhostDD;

    buffer!ransfer.setestinationYtypeS4rocessSD;

    new"ub8ost9esponsetransYportbuffer!ransferD; @@Control transfer to

    client"uch as "enderD

    [

    else @@4revent ata 4acket *ot reachable Condition !wo step

    backD

    W

    ifbuffer!ransfer.getCrossingYhostYnameD.si=eDVX(D

    W

    try

    W

    ifbuffer!ransfer.getCrossingYhostYnameD.si=eDVX(D

    W

    buffer!ransfer.setestinationYnotYreachYhostbuffer!ransfer.getCrossingYhostYnameD.last3lem

    entD.to"tringDD; @@Assign particular 8ost name into *ot 9eachable list

    68

  • 8/12/2019 Catching Stragies

    69/74

    transYportXtransfer#bject.freeupY8ostbuffer!ransfer.getCrossingYhostYnameD.last3lementD.to

    "tringDbuffer!ransferD; @@Free up surrounding host

    buffer!ransfer.getCrossingYhostYname

    D.removebuffer!ransfer.getCrossingYhostYnameD.last3lementDD; @@9emove From

    !ravering 8ost 2ist

    buffer!ransfer.setCurrentYhostbuffer!ransfer.getCrossingYhostYnameD.last3lementD.to"tringD

    D; @@"et Current host name to traverse ne7t teration

    transYportXtransfer#bject.freeupY8ostbuffer!ransfer.getCrossingYhostYnameD.last3lementD.to

    "tringDbuffer!ransferD; @@@@Free up surrounding host (% istance from not reachable

    hostD

    buffer!ransfer.getCrossingYhostYnameD.removebuffer!ransfer.getCrossingYhostYnameD.last3l

    ementDD; @@9emove from !aversing 8ost list

    "ystem.out.printlnS*e7t 8ost to

    4rocess9ecoverD11V.SPbuffer!ransfer.getCurrentYhostDD;

    buffer!ransfer.setestinationYtypeS4rocessSD; @@"et

    type for process another iteration

    new"ub8ost9esponsetransYportbuffer!ransferD;

    @@Control transfer to client"uch as "enderD

    [

    [

    catch37ceptioneD

    W

    "ystem.out.printlnS37ception in not

    reachableSPe.get:essageDD;

    [

    [

    69

  • 8/12/2019 Catching Stragies

    70/74

    elseifbuffer!ransfer.getCrossingYhostYnameD.si=eDVXD

    W

    -#ption4ane.show:essageialognullS*o :ore "ub 8ost

    9eceiver Available in *e7t 8ost 9egion SPbuffer!ransfer.getCurrentYhostDD;

    buffer!ransfer.setestinationYtypeSFailureSD;

    [

    elseifbuffer!ransfer.getCrossingYhostYnameD.is3mptyDD

    W

    -#ption4ane.show:essageialognullS4ut 9eceiver 8ost in (5

    9egionSD;

    buffer!ransfer.setestinationYtypeSFailureSD;

    [

    else

    W

    -#ption4ane.show:essageialognullSestination *ot

    9eachableSD;

    buffer!ransfer.setestinationYtypeSFailureSD;

    [

    [

    [

    publicintfreeupY8ost"tringfreeuphostYparam,uffer!ransfer buffer!ransferD

    W

    try

    W

    teratoriteratorYgetpoint X 4aint4anel.nt.getteratorD;

    whileiteratorYgetpoint.has*e7tDD

    W

    8ost hostYne7tYalterYhost X 8ostD iteratorYgetpoint.ne7tD;

    @@et 8ost list from 8ostContainer Class

    iffreeuphostYparam.e)ualshostYne7tYalterYhost.nameDD

    W

    notYreachYalternateYhostYpointXhostYne7tYalterYhost.position; @@et the 8ost point

    posistion

    70

  • 8/12/2019 Catching Stragies

    71/74

    notYreachYhostportXhostYne7tYalterYhost.host4ort;

    @@et corresponding hostport

    [

    [

    [

    catch37ceptioneD

    W

    "ystem.out.printlnS37ception in etting 4ointSPe.get:essageDD;

    [

    try

    W

    @@ Free up from refuse 2ist host

    teratortree!raverseYdistYfreeupYhost X

    4aint4anel.nt.getteratorD;

    whiletree!raverseYdistYfreeupYhost.has*e7tDD

    W

    8ost hostYne7tYfree X 8ostD

    tree!raverseYdistYfreeupYhost.ne7tD; @@et 8ost list from 8ostContainer Class

    fdt X

    intD:ath.s)rt:ath.pownotYreachYalternateYhostYpoint.71hostYne7tYfree.position.7D (D P

    :ath.pownotYreachYalternateYhostYpoint.y1hostYne7tYfree.position.yD (DD; @@Find the istance

    from "ource and iterate host

    iffdtUX(5D @@Check that particular host is avaiable in

    (5 9egion istance

    W

    buffer!ransfer.get9efuseYpacketYcontainerD.removehostYne7tYfree.hostYidD;

    [

    [

    [

    catch37ceptioneD

    W

    "ystem.out.printlnS37ception in Free1up 8ostSPe.get:essageDD;

    [

    71

  • 8/12/2019 Catching Stragies

    72/74

    returnnotYreachYhostport;

    [ @@3nd function

    [

    W!it'O"'5t.:

    @_

    _ !he class is used to write information to log file

    _ about the #utput eg"ource *ameestinatin name !raverse pathD

    _@

    packageaction;

    importjava.io.File#utput"tream;

    importjava.util.ate;

    publicclass6riteobject

    W

    privateFile#utput"treamfos;

    publicvoidoutput,uffer!ransfer buffer!ransferD

    W

    try

    W

    fos X newFile#utput"treamS!ransferYhistory.t7tStrueD;

    "tringsYlineXS`n11111111111111111111111111111111111111111111111111111111111111111111S ;

    "tringresYoutputXS`n ".*ame XXVSPbuffer!ransfer.get"ourceYnameD

    PS.*ameXXVSPbuffer!ransfer.getestinationYnameD; @@Assign "ource and estinatin name

    for write the log file

    "tringdate X S`nSPnewateD.to"tringD;

    fos.writedate.get,ytesDD;

    fos.writesYline.get,ytesDD;

    fos.writeresYoutput.get,ytesDD;

    fos.writesYline.get,ytesDD;

    fos.writebuffer!ransfer.getCrossingYhostYnameD.to"tringD.get,ytesDD;

    @@isplay traversing ata 4acker path info

    fos.writesYline.get,ytesDD;

    fos.closeD;

    [

    catch37ceptioneD

    72

  • 8/12/2019 Catching Stragies

    73/74

    W "ystem.out.printlnSFile 6riteSPe.get:essageDD;

    [ [

    [

    @. BIBLIOGRAPHY

    REFERENCE PAPERS

    \] ,.1-. Jo and . 9ubenstein istributed self1stabili=ing placement of replicated

    resources in emerging networks< 333@AC: !rans. *etw. vol. M no. M pp. ILBI

    -un. (%%5.

    \(] . Cao 2. Nin and C. 9. as Cooperative cache1based data access in ad hoc

    networks< Computer vol. MI no. ( pp. M(M$ Feb. (%%.

    \M] C.1N. Chow 8. 0. 2eong and A. !. ". Chan roCoca' roup1based peer1to1peer

    cooperative caching in mobile environment< 333 -. "el. Areas Commun. vol. (5 no.

    pp. I$$ -an. (%%I.

    \] !. 8ara Cooperative caching by mobile clients in push1based information systems