I've seen this type of thing when I don't read all the data in the NIO
buffers all the time, across message boundaries.  I personally use state
machines for all my decoding, and you really need to make sure you read all
available data and store it (in my case in whatever message reading state
I'm in).  Basically, it's easy to forget about the "NIOness" of message
reading -- the fact that partial data can come in at any time and the fact
that you always have to read all available data when it's available.

A bit of a shot in the dark, but my bugs along these lines generally have
something to do with the above.  These types of things are also sometimes
hard to catch because they can depend on load, like TCP buffers filling up
to increase the chances of partial messages getting sent -- make sure you
read all messages (one or more) when you get incoming data.

Good luck!

-Adam


On 10/12/07, Gustavo <[EMAIL PROTECTED]> wrote:
>
>
> Hi MINA comunity! I'm having a strange problem with TCP Sockets. I'm
> connecting to a server to exchange messages (this exchange is
> asynchronous),
> I'm using encoders and decoders to translate between these strings and my
> objects.
> I have a MINA client inside an EAR, running on a JBoss 4.0.2. When I try
> to
> connect from my computer it works just fine: the conection is established
> and the messages flows in both ways (client-server / server-client), but
> when I try to do the same from the UAT server it does NOT work. I can't
> receive messages from the server, and apparently, messages are getting to
> the server a little bit different, they get with a different length (yes,
> I
> know this may sound strange but this is what I'm seeing).
> I tryed to isolate the problem by removing JBoss and MINA. So, this is
> what
> I did:
> a) a simple socket program that connects to the server WITHOUT MINA and
> JBOSS. This sometimes work and sometimes not. (I'm sending the same
> message
> over and over again). I ran this program from my computer and from the
> server.
> b) a simple MINA client that does the same thing: send the same message.
> This works OK from my computer and FROM THE SERVER. This client is the
> same
> that I use from within my EAR.
>
> I don't see a difference between running my MINA client as a stand alone
> application or as a part of my EAR. Any clues?
> Is there a reason for the different behaviour between the plain socket
> program and the program that uses my MINA client?
>
> TIA,
> Gustavo Damián Campo.
>
> --
> View this message in context:
> http://www.nabble.com/TCP-Sockets-missing-responses-tf4614733s16868.html#a13178881
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>

Reply via email to