Thank you for the contact, in fact it is quite vague...
I am using server side the Mina StreamIoHandler, to communicate with the client using SreamWrappers. At sessionOpen(), the StreamIoHandler calls processStreamIo(), which starts a new thread to handle the communication with the client:

  @Override
protected void processStreamIo(@NotNull final IoSession inSession, @NotNull final InputStream inInputStreamWrapper, @NotNull final OutputStream inOutputStreamWrapper) { final Worker worker = new Worker(inInputStreamWrapper, inOutputStreamWrapper, inSession);
        _threadPool.execute(worker);
    }

Now, if I expect the connection to stay open, I implement the Worker.run in the following way:

      public void run() {
            try {
                do {
                    executeAction(...);
} while (_keepOpenConnection && _session.isConnected());
            } finally {
                ...
            }
        }


Is it ok, or are there better way to keep the client connection open?


Best regards
sandro


On May 7, 2008, at 3:18 PM, Emmanuel Lecharny wrote:

Sandro Pedrazzini wrote:
Hi,

Can someone tell me, which is the preferred approach, using handlers, to keep the connection open with the clients?
Uh ? Somehow vague question ...

Unless you close explicitely a connexion, or the connexion timeout, it remains open ...

What do you _really_ want to do ?

PS : http://mina.apache.org/contact.html#Contact-BeforePostingYourMessage


--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Reply via email to