oreilly.comSafari Books Online.Conferences.
Articles Radar Books  

Learning the JXTA Shell
Pages: 1, 2, 3, 4, 5


Each application tapping into JXTA is a peer. Your JXTA shell running on your desktop right now is a peer, as is mine on my laptop. The peers command displays all peers already known to my peer, initially only myself and possibly a peer I'm using as an intermediary outside my firewall/NAT.

peer0: name = milne
peer1: name = DIOXINE.NET

JXTA>peers -l [the -l option provides more detail]
peer0: ID = 38e6af70 name = milne 
  addr = http://JxtaHttpClient59616261646162614A787461503250337E00F
peer1: ID = 796f3ac4 name = DIOXINE.NET 
  addr = http://jxta.dioxine.net:6002/

Discovering other peers, peers of peers and so on, is just a matter of propagating a remote discovery request using peers -r.

JXTA>peers -r
peer discovery message sent

[time passes]

peer0: name = piglet
peer1: name = Platform PeerGroup
peer2: name = Platform PeerGroup
peer3: name = milne
peer4: name = NetPeerGroup by default
peer5: name = pooh
peer6: name = Platform PeerGroup

Discovered peers (technically, their peer announcements) are cached locally, stored in environment variables "peer#" where # is the sequential integer associated with a particular peer. To flush all known peers and begin again, use peers -f.

Peer Groups

Each peer belongs to a peer group. By default, each peer is a member of the global "NetPeerGroup" group, analagous to a world without area codes, where every phone number is globally unique. The majority of the time, however, we function within a particular community and can assume the presence of a limited number of appropriate peers. A peer group logically limits the scope of peers with whom you will be communicating, analagous to your local telephone area code. Upon joining a peer group, one sees only other member peers.

As with peers, to find out what groups are known to your peer, use the groups command; to propagate a group remote discovery request, use groups -r

group0: name = NetPeerGroup

JXTA>groups -l [the -l option provides more detail]
group0: GID = 12274c77 name = NetPeerGroup 
  addr = http://JxtaHttpClient59616261646162614A787461503250337E00F

JXTA>groups -r
group discovery message sent

[time passes]

group0: name = piglets
group1: name = tiggers
group2: name = test
group3: name = NetPeerGroup
group4: name = foo
group5: name = foofoo

To join a group, simply use join -d group# where "group#" is the environment variable in which the group advertisement is stored. You are prompted for an identity; technically a UUID, anything will do. To leave, use (surprisingly enough) leave. Here I join the "tiggers" group, look around for peers and leave.

JXTA>join -d group1

JXTA>whoami -g

JXTA>peers -r

[time passes]

peer0: name = tigger
peer1: name = milne


Discovered group announcements, like peers, are cached locally; flush them using groups -f.

Pages: 1, 2, 3, 4, 5

Next Pagearrow

P2P Weblogs

Richard Koman Richard Koman's Weblog
Supreme Court Decides Unanimously Against Grokster
Updating as we go. Supremes have ruled 9-0 in favor of the studios in MGM v Grokster. But does the decision have wider import? Is it a death knell for tech? It's starting to look like the answer is no. (Jun 27, 2005)

> More from O'Reilly Developer Weblogs

More Weblogs
FolderShare remote computer search: better privacy than Google Desktop? [Sid Steward]

Data Condoms: Solutions for Private, Remote Search Indexes [Sid Steward]

Behold! Google the darknet/p2p search engine! [Sid Steward]

Open Source & The Fallacy Of Composition [Spencer Critchley]