Advertisment

Run your Own P2P Network

author-image
PCQ Bureau
New Update

JXTA, a project started by Sun Microsystems, is a set of protocols to set up or develop P2P applications. Project JXTA claims numerous functionalities, which include exotic ones like messaging and file transfers across firewalls, communication across Internet with other remote machines (called peers). 

Advertisment

We explain how to set up a simple P2P network on your existing local network. To demonstrate this we use a JXTA P2P application called JXTA shell. The JXTA shell has a command line interface for messaging, file sharing and downloading and other P2P tasks. However, there is also an easy-to-use GUI interface, called myJXTA, built on top of this shell. On this month’s CD we have given out the JXTA shell application (including the GUI) for both Windows and Linux. The installation is GUI based and simple, even on Linux. 

myJXTA, a graphical peer-to-peer application, allows you to group chat, one-to-one chat and share files

Installation on Windows



On this month’s CD, go to Month’s Flavor>Peer to Peer> JXTA and click on the install button and follow the onscreen instructions. Once installed, you can start myJXTA through start>programs >JXTA>myJXTA. Skip to the section ‘Setting it up’ to proceed. 

Advertisment

Installation on PCQLinux 7.1



Log in as root. Mount this month’s CD and copy the file JXTAInst_LNX_VM.bin found in the directory system\cdrom\flav our\swmonth\linux to /opt (say). Start X Window, by issuing the startx command. Open a terminal window, within X and execute the JXTA installer as:

/opt/JXTAInst_LNX_VM.bin

Follow onscreen instructions, and once through the installation, issue the following in the same terminal.

Advertisment

export PATH=$PATH:/root/JXTA_Demo/jre/bin



export LD_ASSUME_KERNEL= 2.2.14

Later, you should also append the above lines in the file named profile found in /etc directory. You don’t need to re-issue the above commands on subsequent reboots. 

The application gets installed in the directory /root/JXTA_ DEMO. Finally, to launch myJXTA, in the same terminal window in which you had issued the above commands, type the following.

Advertisment

/root/JXTA_Demo/InstantP2P/ip2p.sh

Setting it up



When lunched, myJXTA will initially prompt you for a Peer Name, similar to a nickname on chat. Enter a preferred name, for example, shekhar. Press OK. In the subsequent screen, fill up any username and password (minimum eight characters). The username here is different from the peer name. While the former is the name displayed to other peers, the latter is used for authentication whenever you launch myJXTA. Next, instead of clicking on the OK button, click on the ‘advanced’ button. In the ‘HTTP Settings’ section, uncheck the Enabled checkbox. Finally, click on the OK button. 

When you are shown ‘Waiting for Rendezvous connection’, click on the ‘Proceed Anyways’ button. This will pop up a new myJXTA window as shown in the screenshot. 

Advertisment

By default, you will be a member of a group called NetPeerGroup. The concept of group is similar to that of chat rooms. 



Repeat the above installation process on other machines in your network. The moment a new person logs in, and joins the group NetPeerGroup (which happens by default) he will show up in the group chat section. Click on the tab ‘Group Chat’ of the JXTA window. 

Group chat



Whatever is typed in a group chat is broadcasted to all the members of a group. A user can create his own group also. Suppose you want to create a group named PCQLabs. For this, click on the menu item Group>Create New Group. For the group name enter PCQLabs. If you check the box labeled ‘Create Private Group’ and fill in a group password, then whenever someone tries to join this group, he will be promoted for the group password. When you click on the ‘Ok’ button, all the users currently logged in should be able to see the name of the new group in the top window, labeled as ‘Peer Groups’.



To join a new group, select the group by clicking on it and then click on the menu item Group>Join Group. A ‘joined’ message will appear in front of the selected group indicating that the group has been joined. You can join more than one group. To leave a group, select the joined group and click on the menu item Group>Leave Group. However, you cannot leave the default group–the
NetPeerGroup. 

Individual chat



Individual chat means one-to-one chat, which is unlike a group chat in which the messages are broadcasted to everyone in the group. In JXTA, this chat is similar to instant messaging and Web-based private chat. Click on the ‘Chat’ tab. First, you need to search for the user whom you want to chat with. For this enter the user’s nick in the text field labeled ‘Search User’. Once the user is found, his nick will be displayed in the left pane. Double click on his nick. A message ‘connected with ’ will be displayed. Henceforth whatever you type will be sent only to the intended user. 

Sharing files



The ability to share files across peers has become the most obvious facility in P2P applications. To share files across the myJXTA peers, click on the share tab. Click on the ‘Add content’ button to open a file browser. Select the file you want to share. To download the files shared by other peers, click on the search tab and type in the keyword for the file/content you are looking for. If matches are found, the files are displayed in the result. To download, double click on the filename. 



As you would’ve noticed, there is no server required in P2P collaboration. To get connected, you have to just install the JXTA application on the networked machines. Each of the peers broadcasts its presence across the network. That’s how one peer gets to know about the other and can get connected with it directly to communicate. For more on JXTA go to
www.jxta.org

Shekhar Govindarajan

Advertisment