I have to say I find your server code very strange. You start out by deciding whether the game is over, before you even read anything from either of the clients. And you send several pieces of data to the clients in a particular order, but the clients seem to read those pieces of data in a different order, or perhaps they don't read all of them.
(The fact that the client code tells you what "player 2" did even when it doesn't know who player 2 actually is, that's probably just a confused way of saying "the other player".)
I suspect you don't have a clear description of the communication protocol between the server and the client;
you should write that down first and then write code which actually implements it.