[ 
https://issues.apache.org/jira/browse/DIRMINA-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16858147#comment-16858147
 ] 

Emmanuel Lecharny commented on DIRMINA-1116:
--------------------------------------------

At this point, you have top understand that the server side is just reading 
bytes in the order they have been emitted. MINA does not do any reordering 
whatsoever Once the session is created, it's associated with on single 
{{IoProcessor}} which reads the channel as soon as it gets signaled. In other 
words: if it's garbled on the server, then it's garbled by the client.

Note that on TCP messages may be sliced (ie you can eventually receive an 
entire message one byte by one byte). Get ready for that. That means your 
decoder *must* accumulate data until a full message has been read. You simply 
can't assume that when  you send, say, 4Kb of data, the server will receive 
those 4Kb in one block. It's likely not going to be the case.

> Session Message Order Is Mixed Up Using NioSocketAcceptor
> ---------------------------------------------------------
>
>                 Key: DIRMINA-1116
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1116
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.2
>         Environment: Windows
>            Reporter: Charlie
>            Priority: Trivial
>
> The application requires clients to send communications in a specific 
> sequence. 
> For some reason the messages received by a session sometimes get processed 
> out of order by MINA.
> Here is my usage of MINA:
> {code:java}
> //Setup filter chain
> DefaultIoFilterChainBuilder chain;
> acceptor = new NioSocketAcceptor(Runtime.getRuntime().availableProcessors() + 
> 1);
>  chain = acceptor.getFilterChain();
>  chain.addLast("codec", new ProtocolCodecFilter(new 
> ApplicationProtocolCodecFactory()));
>  chain.addLast("authentication", new AuthenticationFilter());
>  chain.addLast("inputVerification", new InputValidatorFilter());
> acceptor.setHandler(handler);{code}
> The messages are already out of order in the protocol decoder filter.
> The client application sends messages using one thread and uses tcp so it 
> can't be sending out of order.
> Is this intended behavior due to the async model?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to