Skip to main content

new NetworkManger( ) - weird result from getPeerName( )

3 replies [Last post]
siggyuke
Offline
Joined: 2007-10-08

Hi Guys

I'm trying to develop my own chat app using 2.5 as a means to learn jxta.

I've created a form with a login text field & a login button.
When I login in I do a:

......
manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, nameID);
group = manager.startNetwork();
......

nameID being the text from the login textfield.

Later on I do a:

System.out.println("Peer name : " + group.getPeerName());

Simple & all seems fine. The first time I run the app (no .jxta dir has been created in the root dir of the app) the getPeerName() returns the nameID (eg. Pete) I used in creating the NetworkManager.

However, the second time I run the app and use a different login name (eg. Steve)
the getPeerName() returns the old user name (eg.Pete) and not the new one.

If I debug the app the the manager object created shows a member 'instanceName' to be set to Steve.

So the manager object seems to be being created as expected, but the group object returned at creation seems to be registering it as per the old name!?!?

If I delete the .jxta dir & re-run all works as expected again!

Any ideas what's happening here and or a solution?

Cheers

Pete

PS. Anyone know how to include code in a 'code block' rather than have it in-lined with the text?

Message was edited by: siggyuke

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
siggyuke
Offline
Joined: 2007-10-08

Okay, so having looked at the 'Working with local config' example I did a:

config = manager.getConfigurator();
config.setName(nameID);

which seems to have solved the 'problem' I was seeing.

I'd have thought that the call to new NetworkManager() would have done the setName() bit as part of its constructor though!?!?

Cheers

Pete

Is this functionality so that a check for other peers on the network can be made before setting, to make sure that no others have this name!?!?!

Message was edited by: siggyuke

[code]
String str;

if(true)
{
System.out.println("I'm true!");
}
else
{
Str = "I'm false";
}
[/code]

Test to see if a code block can be added!
by adding [ c o d e ] [ / c o d e ] -> remove spaces!
Treats the text as code, but doesn't place it in a scrollable text area.

Message was edited by: siggyuke

hamada
Offline
Joined: 2003-06-12

This is due to a known issue with the network manager, where if an configuration exists, it make little effort in coalescing the exiting configurations

siggyuke
Offline
Joined: 2007-10-08

Thanks for the feedback regarding this issue.