Hey guys!
So, My client and server are both in Java. The server is only receiving one player movement packet from the client and then can't receive any other packets.
Code:
Server reading a movement packet:
case Movement:
float receivedX = packetStr.readFloat();
float receivedY = packetStr.readFloat();
for (GameClient s : connectedPlayers) {
if (s.PlayerSocket.equals(client)) {
s.X += receivedX;
s.Y += receivedY;
System.out.println("X:"+s.X + " - Y:"+s.Y);
return;
}
}
break;
Client sending position every frame update:
public void tick() {
try {
BasePacket movePacket = (BasePacket) new Packet3Movement(this.velX, this.velY);
PacketWriter w = new PacketWriter(server, movePacket);
w.sendPacket();
} catch (Exception e) {
e.printStackTrace();
}
}
The server is only printing the position once and then not printing it at all. When I try sending a disconnect packet, the server doesn't receive that after receiving the movement packet. Any help?