Sending messages to other clients in client connect event <Solved>

<SOLVED - See end for statement>

I have been having some trouble with my code. I have a server that the clients connect to. On connecting I listen for a clientConnect message on the server and send some information over to the connecting client using a normal send. I then try to notify the other clients connected that there is a new one. This is where I have run into problems. If I try and broadcaseExcept (or loop through the clients and use send) it breaks the message sending to all previously connected clients (the new one is fine). There is still a connection (the new client can see the graphics sent from the old ones and the old clients can send messages out) it is just the old clients no longer receive any new messages.


public void clientConnected(final Client client) {

try {

//add the items to our server

Box b = new Box(Vector3f.ZERO, 1, 1, 1);

final Geometry geom = new Geometry(String.valueOf(client.getPlayerID()), b);


Material mat = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat.setColor(“m_Color”, ColorRGBA.Blue);


// Create a appropriate physical shape for it

CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);

final CharacterControl cc = new CharacterControl(capsuleShape, 0.1f);



geom.addControl(new PlayerControl(cc));


Future fut = enqueue(new Callable() {

public List<String> call() throws Exception {

List<String> ss = new ArrayList<String>();



for (Spatial s : rootNode.getChildren()) {



return ss;



try {

List<String> strings = (List<String>)fut.get();

ConnectedMessage sm = new ConnectedMessage(getServerTimeInMilis());


System.out.println(String.format(“Server connecting at %d”, getServerTimeInMilis()));

//send a message detailing the current dynamic items on the server


//broadcast to the other clients that this one has just been added

PlayerConnectedMessage pcm =

new PlayerConnectedMessage(getServerTimeInMilis(), geom.getName());

myServer.broadcastExcept(client, pcm);

} catch (InterruptedException e) {


} catch (ConcurrentModificationException e) {


} catch (ExecutionException e) {



} catch (IOException e) {





Is this the correct behaviour (i.e. am I using it wrong?) If not I will happily debug it, but don’t want to spend the time doing this if it is user error!



EDIT: The problem was, as expected, all my side. I had not designated my PlayerConnectedMessage as serializable. Sorry for wasting peoples time!