Peer-to-Peer (Amoretti et al., 2008) has come
to solve some of the client/server architecture problems.
It already exist in the market so many Peer-to-Peer technologies like
JINI that promise to interconnect any type of device over any type of
network but its limited on the Java language; Gnutella that provide
a communication between peers but it capable of traversing only a single
Obviously, we needed a more powerful technology, JXTA has brought the
solution. JXTA is an open network computing platform designed for Peer-to-Peer
(P2P) computing by way of providing the basic building blocks and services
required to enable anything anywhere application connectivity.
The JXTA is short hand for juxtapose. It is a recognition that P2P is
juxtaposed to client-server or Web-based computing, which is todays
traditional distributed computing model.
The JXTA provides a common set of open protocols backed with open source
reference implementations for developing Peer-to-Peer applications. The
JXTA protocols standardize the manner in which peers:
||Discover each other
||Self-organize into peer groups
||Advertise and discover network resources
||Communicate with each other
||Monitor each other
The JXTA protocols are designed to be independent of programming languages
and transport protocols alike. The protocols can be implemented in the
Java programming language, C/C++, .NET, Ruby and numerous other languages.
Furthermore, they can be implemented on top of TCP/IP, HTTP, Bluetooth
and other network transports all the while maintaining global interoperability.
Many projects were created by the JXTA community (Microsystems,
2007). JuMP a management framework for the JXTA platform, built over the
manager/agent model. Jxse-rmi, provides the standard familiar RMI interface
on top of JXTA, it makes use of JXTA pipes to allow RMI connections between
authenticated peers. Jxtacast, broadcast files through propagation pipes. Jxse-cms,
a single content management system for JXSE (Ismail et
al., 2008). Myjxta, Peer-to-Peer instant messenger through unidirectional
pipes, it also use the jxse-cms to allow file sharing, etc.
In this study, we created a chat and a sharing files application too,
but unlike Myjxta we used bidirectional pipe that offer a reliable and
bidirectional communication between peers.
The Peer-to-Peer: It is an architecture that enables any network-aware
device to provide services to another network-aware device (Wilson,
The Peer-to-Peer it is an overlay network, in the Peer-to-Peer network:
||A peer is a processor, an application; it can be any
||A peer has a sensitization for the other peers
||The communication between the peers is by the TCP and
the HTTP protocols
The most popular Peer-to-Peer applications are: collaboration, games,
file sharing, content distribution, grid computing and chat applications
in which the peers directly interact with each other we will talk about
it more lately.
JXTA: It is an open network computing platform with a set of sex
protocols that support Peer-to-Peer.
It is made of three layers, the first one is the core layer it provides essential
elements used by the services the second layer that provide network services
for the last layer application layer that provide the most common Peer-to-Peer
application. (Arora et al., 2002).
The goals of JXTA are:
||Programming language independence
||Operating system independence
The six JXTA protocols are based on XML message, each protocol is semi-independent
of the others and each protocol conversation is divided into two portions, one
in the local peer that responsible for the generation and sending the messages,
the other one is in the remote peer that responsible for handling the incoming
messages and processing it to perform a specific task (Microsystems,
The six protocols are:
||Peer Discovery Protocol (PDP): Used by peers
to advertise their own resources and to discover resources from the
||Peer Information Protocol (PIP): Used especially
by a monitoring peer to get status information about peers (Uptime,
state, recent traffic, etc.)
||Peer Resolver Protocol (PRP): Used to standardize
queries sent on the network, thus it is enable peers to send a generic
query to one or more peer and receive it response. It allows peer
to exchange any arbitrary information needed
||Pipe Binding Protocol (PBP): In the JXTA network
peers use pipe for communication, so they can create a new pipe, bind
to an existing pipe or unbind from a pipe for those cases we use the
||Endpoint Routing Protocol (ERP): Used to rout
messages to its destination, it helps peers to know about available
routes for sending messages
||Rendezvous Protocol (RVP): Used by peers to propagate
messages within a peer group
The JXTA peers do not have to implement all these protocols; they only
need to implement the ones that they will use.
The JXTA concepts
Peer: Any device in the network that implement one or more JXTA protocol,
it could be a PDA, Laptop, PC, cell phone, etc.
A peer is uniquely identify by a Peer ID, it publish one or more network interface
peer endpoint to enable multi protocol use, it exist three types of peer: (Traversat
et al., 2003):
||The simple peer: Usually exist inside an internal
network, it has the least amount of responsibility in the Peer-to-Peer
network, it provide services to the network and consume services providing
by other peers
||The Rendezvous peer: Usually exist outside a
private internal networks firewall, it help peers to discover
other resources of the network (peers) either by caching peer advertisement
or by forwarding discovery request
||Router (Relay) peer: Provides a mechanism to
communicate with peers separated from the network by barriers firewall,
NAT, peers that are not routers must determine a router peer to use
to route their messages
Peer group: A set of peers formed to serve a common interest or
goal dictated by the peers involved. It provides services that can be
accessible to it members only, it is uniquely identify by the group Id.
its created for reasons of security, scoping or monitoring.
Endpoint: Its the peer network interface (Tcp port + IP
address) used to send and receive data.
Advertisement: It describes the network resources such as peers,
peer groups, pipes, etc. An advertisement is represented as an XML document;
it is used by peers to discover the network resources.
Pipe: Provide an asynchronous, unidirectional, virtual communication
channels between two or more endpoints.
JxtaSocket and JxtaBiDipipe: Built on top of pipes, endpoint messengers
and the reliability library, provide a bidirectional and reliable communication
Messages: An object that is sent from one endpoint to another
over pipe. The peer package the data to transmitted into messages using
the output pipe, the peer that receive the messages from an input pipe
extract the transmitted data. A message can be an XML format or Binary.
Security: The use of XML messages five us the ability to ass supplement
metadata such as credentials, certificates, digests and public keys to a JXTA
message that provide it security (Daniel et al., 2002).
Implementation of a LAN chat application: At this point, we should
be familiar with the basics of JXTA, now we will use some of it protocols
and concepts to implement a simple chat application, it is similar to
the other instant-messaging applications but it incorporate many of the
This application is designed in a LAN; it gives us the capability to
register, sign in, search for the connecting peers, exchange messages
and to sign out.
The implementation requires to install the Java, JDK in your machine and to
download JXTA jxse-lib, tutorial, documents, src (Microsystems,
The next step is to create the frame using the swing classes for the
GUI (Graphics User Interfaces) in which we will invoke the classes that
we are going to create.
We create a class StartMe() it job is to create the peer that will be
a Rendezvous peer if its the first one in the NetPeerGroup or a
simple peer if we already have a Rendezvous peer for the g roup, then
we are going to check the existence of any network configuration to set
the peer name, the peer ID and the protocol Tcp.
Once this step has succeeded we invoke the startNetwork() method to launch
the JXTA network. As shown in Fig. 1.
The class Rdiscovery() it responsibility is to generate the discovery
queries and to receive the discovery responses.
||Starting JXTA interface
The last class Rchating() is going to set up a bidirectional and reliable
communication between the peers using the JxtaServerPipe that expose a
input pipe to process connection requests, whereby the JxtaBiDiPipe bind
to respectively to establish private dedicated pipes independent of the
connection of the request pipe (Fig. 2). The JxtaBiDiPipe
use a messenger instead of an output pipe.
The class Rsharing() is going to create an instance of CMS (Contreras
et al., 2003) for the peer group to start the sharing and to process
the incoming request for shared files. It will also stop the CMS in case we
want to stop sharing our files by calling the method stopApp().
The class Rsearching() is going to create a listener to process the results,
a ListRequestor to initiate the search, a method notify More Results()whenever
a peer respond with a list of results and show them in a table (Fig.
3). It will also stop the search process by calling the method cancel()
of the ListRequestor.
The class Rdownloading() extends the GetContentRequest is going to create a
GetRemoteFile class that process the incoming list and handle the process of
reconstituting a document from another peer, the method GetRemoteFile() will
download the desire file and show us the download progress.
This article has introduced to the Peer-to-Peer world and what has the JXTA
platform brought to it, as we showed, an implementation of an instant-messaging
application that can be further extended. As long as you go deep in this platform
you will find how rich it is.