Articles Weblogs Books School Short Cuts Podcasts  

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 =

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