OK. Thanks. One question more:
if I create a new filter (iofilter1 ) , so I have iohandler -------> iofilter1 When I receive a message , messageReceived on iofilter1 is executed and , finally , messageReceived on iohandler is executed If I put the code that sends "test" in iofilter1 and "( doing other stuffs )" in iohandler's messageReceived would it work ? i mean , would be "test" sent before iohandler's messageReceived is executed? Thanks 2013/7/26 Emmanuel Lécharny <elecha...@gmail.com>: > Le 7/26/13 11:46 AM, Jose María Zaragoza a écrit : >> Hello: >> >> >> I'm using Mina Core 2.0.7 >> >> I use BufferedWriteFilter to send data and every time I write data for >> sending it , I flush this filter manually by this code: >> >> this.session.write(data); >> ((BufferedWriteFilter) f).flush(this.session); >> >> >> >> Sometimes I've to send data from the messageReceived() callback method. >> I've observed that until messageReceived() finishes , data is not sent >> >> Example: >> >> public void messageReceived(IoSession session, Object message) throws >> Exception >> { >> >> session.write("test"); >> ((BufferedWriteFilter) f).flush(session); >> >> ..... >> ..... ( doing stuffs ) >> ...... >> >> ( **here**, "test" is sent ) >> } >> >> >> How I can send data immediatly in messageReceived() ? > > > You can't. Or if you want to do so, then do your write, and move the > logic you execute after the call to write() into the messageSent() method. > > -- > Regards, > Cordialement, > Emmanuel Lécharny > www.iktek.com >