>>>>> 3) what would be better is to use a dedicated socket to send the data >>>>> to >>>>> the >>>>> remote peer (see FtpServer) >>>> >>>> Is it really a good idea to open a dedicated socket for each client if >>>> we have 1000+ clients? >>> >>> Should not be an issue. Opening sockets is not costly, nor keeping them >>> opened. >> >> Why is it better (separate sockets)? This scales well or performs well? > > You have to do your homeworks here :)
Before I started experimenting with MIna I had no chance to work with sockets nor read about programming them. So, if you have time it would be kind of you to drop a couple of lines about it :) >>>>> 4) otherwise, if you decide to send the data in small chunks, then you >>>>> have >>>>> to deal with the MessageSent event >>>>> >>>>> Talking about the 4th item, as soon as you wait to be waken up when >>>>> the >>>>> last >>>>> chunk has been sent, then the thread will be available for other >>>>> sessions. >>>> >>>> Yes, but how to issue an asynchronous chunk send request and exit from >>>> handling MessageSent event in IoHandlerAdapter + when chunk >>>> successfully transmitted how to make Mina call again the method which >>>> transfers the data to send the next chunk? >>> >>> You will have to maintain a session variable which store the current >>> state >>> of your session. When you receive a request, you prepare the data you >>> want >>> to send, and split them in small chunks. Then you send the first chunk in >>> the messageReceived() method, and all the others in the messageSent() >>> method. >>> >>> At least, this is how I would do that. >> >> One important feature: does this means that after issuing send (finish >> messageReceived event) this thread becomes free and ready for event >> for other sessions (returned to thread pool used by Exec Filter or >> smth like this)? > > Of course. Thank you, Emmanuel, now it is clear for me. -- Kind regards, Antonio Rodriges
