Hello all I am trying to program a simple network game with the help of Mina. I am using version 2.0 RC1 of Mina right now. For the moment my game is very simple. I have a simple server which writes any incoming message in its messageReceived method out to any connected client. I use the ObjectSerializationCodecFactory as a protocol codec filter and my messages are very small only having a small number of fields.
So much for the setup. This system seems to work rather well for only two connected clients and I even tested it successfully in a distributed manner. But in the last few days I tried to setup a server on my local machine with four local clients connected. With these setup a few strange delays occur. It often happens that messages don't get written right away to the client but only a considerable number of seconds later. (about 5 seconds up until 20 seconds...). Here is a simple example: Rhe server receives an incoming message in the messageReceived method and writes this message immediately to every of its four connected clients. Then the server sends the message right away out to three out of the four connected clients. I can see that by logging the calls to the messageSent method. But the server calls the messageSent for the fourth client only about 5 seconds later and sometimes even later. This behaviour happens quite often at about 25% of every incoming message event. At other times all the four clients get the message right away. I don't know much about the inner workings of NIO and/or buffers so this could be trivial. I am not very sure if this is an expected behaviour (maybe a buffering problem?), or if I could do something against that. But I am very surprised that in this simple setting with only local clients and a local server a delay of several seconds can even occur. Any suggestions on how I could solve this issue are very welcome. Thanks Daniel
