So thanks for your post and sorry, I'm french, I have some problems when I wan't to explain something !
For the code I can't give you the whole client (much more 1 millions lines of codes...), I can, on the other way, give you only the reading part of the client network thread (the OpenGL thread will not help you because it's rendering...).
Here is the code :
- Boolean disconnected is true when an error has been thrown and the network thread will be automaticaly killed by the OpenGL thread (the disconnected window do that killing work),
- packetManager refers to my NetClientPacket witch map all network packets,
- readFromNetwork : void witch retrieve all the packet content from DataInputStream,
- handle : void who contains commands destinated to OpenGL thread,
- theGame refers to the OpenGL thread,
- getNetPacketFromId : void that return the mapping packet (instance) from his index number,
- userInput refers to the DataInputStream of the current playing logged in user (each ClientNetwork instance has it's own DataInputStream and DataOutputStream).
Note that updateClient void is called when instantiate the network thread (only mounted if the connection to server has not failed).
I hope you will be able to help now,