Skip to main content

Brendon wilson jxta chat example application

6 replies [Last post]
somkumar155
Offline
Joined: 2007-11-16
Points: 0

Brendon wilson jxta chat example application compile and run but doesnt show ny user online , ny1 knows y this is happening........
plzzzzzzzzz tell m eits urgent........

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jeehard
Offline
Joined: 2008-05-26
Points: 0

A have the same problem Do you fix it? I really don't know what changes to do for application to work. I apreciate if you tell me that you solve the problem or not.

somkumar155
Offline
Joined: 2007-11-16
Points: 0

yes , i m using advertisements fr currently online peers
:)

jeehard
Offline
Joined: 2008-05-26
Points: 0

Ok! Could you be more specific? Can you please send me the sorces? I really need them.
Thank you in advance!

somkumar155
Offline
Joined: 2007-11-16
Points: 0

public void run() {
try {
// Add ourselves as a DiscoveryListener for DiscoveryResponse events

discovery.addDiscoveryListener(this);

discovery.getRemoteAdvertisements(null,
DiscoveryService.PEER,
null,null, 1, null);
discovery.getRemoteAdvertisements(null,DiscoveryService.ADV,"Name",null,1, null);

while (true) {
// wait a bit before sending a discovery message
try {
t.sleep(1000);
} catch(Exception e) {
}
System.out.println("Sending a Discovery Message");
// look for any peer
discovery.getRemoteAdvertisements(

null,
DiscoveryService.PEER,
null,
null,
10,
null);

discovery.getRemoteAdvertisements(null,DiscoveryService.ADV,"Name",null,1, null);

}
} catch(Exception e) { }

}

/**
* by implementing DiscoveryListener we must define this method
* to deal to discovery responses
*/

public void discoveryEvent(DiscoveryEvent ev) {
int adCount=0;

DiscoveryResponseMsg res = ev.getResponse();

Advertisement adv=null;
Enumeration enum1 = res.getAdvertisements();

if (enum1 != null ) {
while (enum1.hasMoreElements()) {

adv = (Advertisement) enum1.nextElement();

String name="";
if (adv instanceof PeerAdvertisement)
{

name = ((PeerAdvertisement)adv).getName();
String pid1=(((PeerAdvertisement)adv).getPeerID()).toString();

//display the name of client in list
m.updateList(a);

}

ovyb
Offline
Joined: 2009-01-25
Points: 0

can you be more specific, especially with the run method, where to put? how the code should be modified because of the many I saw in the brendon's code getting the remote advertisement is treated , but still not working, someone has an idea how to solve this problem? I'm in great need for an answer. Thanks in advance!

hamada
Offline
Joined: 2003-06-12
Points: 0

Rely on the jxta tutorials instead, as they are fairly maintained. The bidi and propagated tutorial should serve your 1-1, many-to-many needs respectively.