Skip to main content

how to get the Peer TCP address

3 replies [Last post]
xczno1
Offline
Joined: 2009-08-20

please help me and forgive me my poor English.

I want to get the Peer's IP address while getting the PeerID and PeerName.
what should I do?

Enumeration e = discovery.getLocalAdvertisements
(DiscoveryService.PEER,null, null);
while (e.hasMoreElements()) {
PeerAdvertisement adv = (PeerAdvertisement) e.nextElement();
PeerID = adv.getPeerID().toString();
PeerName = adv.getName().toString();

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
yasseen
Offline
Joined: 2009-05-31

Hi,
JXTA facilitate IDs instead of IP addresses , so I don't think IP addresses will be used while communicating with another peers .

could you please explain what are you going to accomplish ?

Regards

Y.

xczno1
Offline
Joined: 2009-08-20

Thanks for your reply.

I need the Peer IP to do other things.
for example, I need the IP to backup the database,
and I need the IP to compare it with Load Balancing serversIPlist,
because the Peer is also used as a server to providing web service in my application. So please tell me how can I get it? Thanks very much!!

yasseen
Offline
Joined: 2009-05-31

hi,

store it in that message you send it to another peer and in another side restore it from the message as soon as ii is received .

I did the same think when I tried to get some information from a remote peer.

Regards

Y.