Skip to main content

Another question!

2 replies [Last post]
dc5
Offline
Joined: 2008-08-31
Points: 0

Hey folks,

I have been working through the examples in Practical JXTA book and I feel I understand them all, particularly the bidi pipe example which I was most interested in.

All of these examples though were coded to be ran of the same computer, and the location of each peer is hard coded. My question is, what is the next step towards getting peers discovering and making connections with other peers on their own without having to rely on hard code? How much harder is it than the examples I understand?

Any answers will be extremely helpful and thank you for your time, I dont mean to be a pest.

Thanks,

DC5

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
iiggoorr
Offline
Joined: 2008-09-22
Points: 0

Hi,
you shouldn't have problems. It is right that all examples are made to run on a single machine, and some staff are hard coded.
If you want discovery to work in the LAN environment you should just study out discovery service. In LAN env. Discovery uses multicast.

If you want to connect two peers you need to create input pipe on one peer, publish it with discovery service of group both peers are in. After that you need to discover that advertisement and create output pipe with it.

Since you have gone through examples you probably don't need this but still.

spouse net is PeerGroup instance containing net peer group.
You need this methods:

net.getPipeService for creating input and output pipe

net.getDiscoveryService. publish for advertising input pipe.

net.getDiscoveryService.getRemoteAdvertisements for finding input pipe adv.

net.getDiscoveryService.getLocalAdvertisement for getting input pipe advertisement from local cash. if zou use listener for discovery, you don;t need this one.

if you want discovery to work over the LAN edge you will need to have RDV and relay peer of your one, ore you should just use default seeding peers of JXTA network.

Everything else works the same way with exception, it is good idea to use remotePublish insted of publish method, since this way advertisement will be sent to RDV peer.

dc5
Offline
Joined: 2008-08-31
Points: 0

iiggoorr thank you for reply.

Hopefully I will get on ok!

Thanks,

DC5