Strange behavior with messages

  ... the Multiplayer Extension for AndEngine.

Strange behavior with messages

Postby MTGap » Wed May 25, 2011 1:31 am

I'm experiencing some strange behavior with messages between my client and server. Here's what I've recorded when a client connects each time:

May 24, 2011 4:49:46 PM com.gap.game.LogWriter log
INFO: 69.246.26.228 connected to server
AndEngine ServerAndEngine Serverjava.lang.IllegalArgumentException: No message found for pFlag='-32768'.
AndEngine Serverorg.anddev.andengine.extension.multiplayer.protocol.util.MessagePool$1<AuthenticatePlayerClientMessage> was exhausted, with 0 item not yet recycled. Allocated 1 more.null
May 24, 2011 4:50:04 PM com.gap.game.LogWriter log
INFO: 65536 - -
May 24, 2011 4:50:04 PM com.gap.game.LogWriter log
INFO: 1
AndEngine ServerAndEngine Serverjava.lang.IllegalArgumentException: No message found for pFlag='1389'.
AndEngine ServerAndEngine Serverjava.lang.IllegalArgumentException: No message found for pFlag='29799'.
AndEngine ServerAndEngine Serverjava.lang.IllegalArgumentException: No message found for pFlag='24944'.
AndEngine Serverorg.anddev.andengine.extension.multiplayer.protocol.util.MessagePool$1<RoomChangeRequestClientMessage> was exhausted, with 0 item not yet recycled. Allocated 1 more.null
AndEngine ServerAndEngine Serverjava.lang.NullPointerException
AndEngine ServerAndEngine Serverjava.lang.IllegalArgumentException: No message found for pFlag='29797'.
AndEngine ServerAndEngine Serverjava.lang.IllegalArgumentException: No message found for pFlag='29556'.
AndEngine Serverorg.anddev.andengine.extension.multiplayer.protocol.util.MessagePool$1<ReadyClientMessage> was exhausted, with 0 item not yet recycled. Allocated 1 more.null
May 24, 2011 4:50:24 PM com.gap.game.LogWriter log
INFO: 69.246.26.228 disconnected from server
AndEngine ServerAndEngine Serverjava.lang.IllegalArgumentException: No message found for pFlag='-32767'.
May 24, 2011 4:50:40 PM com.gap.game.LogWriter log
INFO: 69.246.26.228 disconnected from server


The first odd thing is that there is some odd message being sent by the client: No message found for pFlag='-32768' as well as multiple other ones. I have no clue where these are coming from and they are always the same numbers at the same times when a client connects. None of my flags are even close to these numbers.

Another strange thing is that the AuthenticatePlayerClientMessage class is being allocated in the message pool before one is even needed. I'm pretty sure that messages are only added to the pool when they are received.

One more issue is that my AuthenticatePlayerClientMessage isn't correctly passing information from the client to the server. It is supposed to contain one integer, and two strings in the data stream. When I output these fields I get: '65536 - - ' Where the first component is supposed to be 1, and then after the first dash a string and then another string. I think this may have to do with AuthenticatePlayerClientMessage being allocated early. One time it did work, but at that time the client lost wifi connection and then reconnected without the server realizing.

After the ReadyClientMessage everything appears to be working. Anyone have any ideas?
MTGap
 
Posts: 61
Joined: Sun Nov 28, 2010 12:35 am

Re: Strange behavior with messages

Postby ashes » Wed May 25, 2011 2:18 pm

I think I had the same issue once ... check if your ServerMessage class has an empty constructor
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  public MyServerMessage() {}
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
additionally to the constructor that you use to create the message e.g.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  public MyServerMessage(final int pValue) { mValue = pValue; }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


And check if you use the latest multiplayerextension.jar.
ashes
 
Posts: 13
Joined: Sun Feb 20, 2011 1:47 pm

Re: Strange behavior with messages

Postby MTGap » Wed May 25, 2011 2:37 pm

Wow, thank you! My server had the latest library, but my client had the library right before the pseudo messages had been removed. Does the andengineexamples have the latest jar?

Edit: It doesn't appear to, anywhere I can grab it from quickly?
MTGap
 
Posts: 61
Joined: Sun Nov 28, 2010 12:35 am

Re: Strange behavior with messages

Postby ashes » Wed May 25, 2011 4:15 pm

This should be the latest one I compiled.

But the best way to be up to date is getting the sources via Mercurial and export a .jar by yourself (e.g. with Eclipse IDE it is really easy).
Attachments
andenginemultiplayerextension.jar.7z
(67.09 KiB) Downloaded 146 times
ashes
 
Posts: 13
Joined: Sun Feb 20, 2011 1:47 pm


Return to Multiplayer

Who is online

Users browsing this forum: No registered users and 3 guests