[SOLVED] Kryonet Packet Recieving Issues

I’m just having a play around with Kryonet at the moment, trying to learn how it works and all that. Here’s my issue:

Whenever my client sends a packet, the server never tends to pick it up

ServerNetworkListener.java:


public class ServerNetworkListener extends Listener {
	public void connected(Connection c) {
		System.out.println("SOMEONE CAME IN :D");
	}
	
	public void disconnected(Connection c) {
		System.out.println("SOMEONE LEFT D:");
	}
	
	public void received(Connection c, Object o) {
		System.out.println("hit");
		if (o instanceof Packet) {
			Packet p = (Packet) o;
			if (o instanceof Packet001LoginToServer) {
				String user = ((Packet001LoginToServer)p).username;
				System.out.println(user + " logged in!");
			}
		}
	}
}

ClientMain.java:


public class ClientMain {
	private Client client;
	
	public ClientMain() {
		client = new Client();
		client.start();
		
		client.addListener(new ClientNetworkListener());
		
		Kryo k = client.getKryo();
		k.register(Packet001LoginToServer.class);
		
		try {
			client.connect(5000, InetAddress.getLocalHost(), 1234);
			client.sendTCP(new Packet001LoginToServer("LOLOLO"));
		} catch (Exception e) {
			e.printStackTrace();
			client.stop();
		}
		
//		String s = (String)JOptionPane.showInputDialog("Enter your username");
	}
	
	public static void main(String args[]) {
		new ClientMain();
	}
}

Here’s the output from the console:


SOMEONE CAME IN :D
SOMEONE LEFT D:

The connection to the server is clearly working, as the server outputs the text it should have output when a client connects, but it never outputs ‘hit’ or the username as I have coded it to.

Have I misunderstood here? Or is this just a bug in my network listener?

Thanks in advanced :smiley: