However, I'm getting many errors and instability in the Pong Example. There are two bugs that I found.
When you exit the PongGameActivity, the onDestroy method is executed. This causes a runtime exception. This may be minor but I'd like to handle ending the server correctly. As you can see, the failure point is sandwiched between my comments in the code.
Using java Syntax Highlighting
- @Override
- protected void onDestroy() {
- if(this.mServer != null) {
- try {
- this.mServer.sendBroadcastServerMessage(new ConnectionCloseServerMessage());
- } catch (final IOException e) {
- Debug.e(e);
- }
- this.mServer.terminate();
- }
- // BUG OCCURS HERE
- if(this.mServerConnector != null) {
- this.mServerConnector.terminate();
- }
- // BUG IS ABOVE
- super.onDestroy();
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
And here is the error message.
Using java Syntax Highlighting
- 06-20 20:26:28.970: E/AndEngine(20161): java.net.SocketException: Socket closed
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
The next error is much more alarming since it happens during game play and is causing instability. The bug is this. After I connect both devices (Galaxy tab 10.1 is the server, Samsung smartphone is the client), the game will just crash and I will get this error.
Using java Syntax Highlighting
- 06-20 20:23:56.646: E/AndEngine(16311): java.net.SocketException: Bad file number
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
I discovered AndEngine in April and have been loving it ever since. However, I really want to get Multiplayer working. For those that are more veteran to the engine, do you have any tips? Or is there an older version of AndEngine or the Multiplayer Extension that works with high stability?

