Messages not being recieved correctley

Hello mates! I am trying to send a string from my client to my server but everytime I do, the server receives something along the lines of this: 0<span style=“text-decoration:underline;”> is located at Server.Server$location@42fbc0bd</span>
I have send my players location using this:

    Message location = new location(player.getPhysicsLocation().toString());
    location.setReliable(false);
    Client.send(location);

With my my message class as such:

@Serializable
public static class location extends AbstractMessage {

    private String location;       // custom message data

    public location() {
    }    // empty constructor

    public location(String s) {
        location = s;
        System.out.println(location);
    } // custom constructor
    
}

And my receiver on the server side as the following:

@Serializable
public static class location extends AbstractMessage {

    private String pLocation;
    
    public location() {
    }

    public location(String pLocation) {
        this.pLocation = pLocation;
    }
}

I have looked at tutorials and still cant figure out how to prevent my text from looking like it is encrypted. Thanks for all your help!

Also, pardon the typo in the topic and the code being unformatted. I am using my Surface Pro which doesn’t support autocorrect or the forums formatting tools

Are you using separate “location” classes for the client and server? Also, why are you using a string to represent the location instead of using a Vector3f?

This: Server.Server$location@42fbc0bd
…is the default implementation of toString() for the class that you’ve created for location.

Here’s the part where I sound like I’m insulting you but I’m actually trying to be helpful and save you years of grief.

Order of operations:
-learn Java
-write a simple single player game
-write a simple 3D single player game
-write a simple multiplayer game.

Writing a multiplayer game is the hardest thing to do… and you are still being tripped up by normal Java-level stuff.

Also, as I said before. You need the EXACT SAME CLASS on both client and server. Not a “class that looks exactly the same”. The EXACT SAME. Like same file. Same .java file, whatever. The exact specifically the same exact same identical same file on disk class file.

Thanks for all you help guys! I wasn’t aware of that and am now hitting myself. And @pspeed, I completely agree with you, I am quite new and shouldn’t be foraying thus far just yet, especially when I make mistakes this simple. I am going to go back and make sure I cover all the basics I missed when I started, though I can’t say I will stop dabbling in this type of code :). And also, I wasn’t aware it had to be exact (luckily it was), thankyou for warning me for future reference.

@IdreesInc said: Thanks for all you help guys! I wasn't aware of that and am now hitting myself. And @pspeed, I completely agree with you, I am quite new and shouldn't be foraying thus far just yet, especially when I make mistakes this simple. I am going to go back and make sure I cover all the basics I missed when I started, though I can't say I will stop dabbling in this type of code :). And also, I wasn't aware it had to be exact (luckily it was), thankyou for warning me for future reference.

Just FYI, in this thread (your thread): http://hub.jmonkeyengine.org/forum/topic/registration-error-no-argument-constructor-not-found/

I essentially said that.

@pspeed said: "no-argument constructor not found on:class Server.Server$connected"

It’s because it’s not a static inner class. When you have a non-static inner class then there is a hidden parameter to the outer instance since you cannot instantiate a non-static inner class without having an instance of the outer class.

Make the class static or break it out into its own class. The latter is probably a safer idea since you will need this exact same class available on both client and server… registered in the EXACT same order.

Be careful to catch the important details. :slight_smile: