mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ubaggili <ubagg...@jinsys.org>
Subject how to guarantee flushed write in encoder - mina-2.0.0-M1-snapshot
Date Thu, 04 Oct 2007 13:44:17 GMT


I have spent a lot of time trying to figure out how I can write and flush
"abc" through the ProtocolEncoderOutput but I have been unsuccessful.  I
must be missing something too obvious as usual!

In Mina 1.1.2, there was no issue with this.  I would be able to send off
"abc" and "def" and they would get sent as 2 packets.  With Mina-2.0-m1, I'm
unable to do so.  I have tried every trick and flip and flush, but I haven't
been able to reliably solve this.  In some cases, the 2 messages are sent
off separately but in as many others they are sent off as one packet.  I've
even set the tcpnodelay property to false (which seems to be counter
intuitive) but that wasn't it either.

Any hints would be greatly appreciated.  Here is my sample code:

public class AgiCommandEncoder implements MessageEncoder {
    public void encode(IoSession session, Object message,
ProtocolEncoderOutput out) throws Exception {
        CommandRequest agiCommandRequest = (CommandRequest) message;
        byte[] commandAsBytes = commandRequest.getCommand().getBytes();
        IoBuffer buffer = IoBuffer.allocate(commandAsBytes.length, false); 
//<==== IoBuffer is the new-old ByteBuffer in trunk

This encoder is registered as part of the DemuxingProtocolCodecFactory
extended object.

Thanks in advance,
View this message in context: http://www.nabble.com/how-to-guarantee-flushed-write-in-encoder---mina-2.0.0-M1-snapshot-tf4568900s16868.html#a13040109
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

View raw message