Re: synchronous responses to client

2006-10-13 Thread James Im
IoSession session = ...; WriteFuture future = session.write(...); // Wait until the message is completely written out to the O/S buffer. future.join(); I was looking at this code and I got an idea. As we want mina to be as non blocking as possible may be instead of having the thread waiting it

Re: synchronous responses to client

2006-10-12 Thread Mark
I think I may have figured this out, the javadocs are a little confusing. In WriteFuture the javadocs say: IoSession session = ...; WriteFuture future = session.write(...); // Wait until the message is completely written out to the O/S buffer. future.join(); I thought the Wait until the

Re: synchronous responses to client

2006-09-19 Thread Mark
when I look at the FTP traffic, it appears as though the responses from my FTP Server do no match up with what the client is sending. When MINA sends data to a client using IoSession.write(), does that data get sent immediately, or is it queued in some fashion? Thank you. On 9/18/06, Vinod

Re: synchronous responses to client

2006-09-19 Thread Greg Duffy
There is definitely a queue, as the IoSession.write(...) method is asynchronous. Quoth the javadoc, http://directory.apache.org/subprojects/mina/apidocs/org/apache/mina/common/IoSession.html#write(java.lang.Object) As you can see from that link, you may wait for the message to be written by

Re: synchronous responses to client

2006-09-19 Thread Mark
thanks. RTFM strikes again!! :) On 9/19/06, Greg Duffy [EMAIL PROTECTED] wrote: There is definitely a queue, as the IoSession.write(...) method is asynchronous. Quoth the javadoc,

Re: synchronous responses to client

2006-09-19 Thread Niklas Therning
Instead of blocking on the WriteFuture you may want to implement IoHandler.messageSent(). For every call to session.write() there will be a matching call to messageSent() once the message you wrote has been sent. This avoids blocking the current thread and should make things more scalable.

Re: synchronous responses to client

2006-09-19 Thread Trustin Lee
On 9/19/06, Niklas Therning [EMAIL PROTECTED] wrote: Instead of blocking on the WriteFuture you may want to implement IoHandler.messageSent(). For every call to session.write() there will be a matching call to messageSent() once the message you wrote has been sent. This avoids blocking the

Re: synchronous responses to client

2006-09-19 Thread Niklas Therning
True! :) One thing though: if I use a listener like you suggest I think it will be called from within the SocketIoProcessor's worker thread, right? If that's the case it's very important not to do any heavy processing in such a callback otherwise that SocketIoProcessor would be completely

synchronous responses to client

2006-09-18 Thread Mark
I am working on a FTP server using MINA, and it appears that the responses that the FTP server are sending back to the client are asynchronous. Based on my understanding of the protocol, the responses need to be synchronous. So the client sends a command, and the server sends a response. Is

Re: synchronous responses to client

2006-09-18 Thread Vinod Panicker
On 9/19/06, Mark [EMAIL PROTECTED] wrote: I am working on a FTP server using MINA, and it appears that the responses that the FTP server are sending back to the client are asynchronous. Based on my understanding of the protocol, the responses need to be synchronous. So the client sends a