On Thu, May 12, 2011 at 6:21 PM, Emmanuel Lecharny <[email protected]> wrote:
> On 5/12/11 12:18 PM, Muhammad Ichsan wrote:

> The session will be opened anyway. What you should do is to store a state in
> the session, and send a message to the client when the sign-in has not been
> done. Calling sessionOpened() in the messageReceived hs no effect and does
> not send anything to the client. Do a session.write( "You first have to sign
> it" ) instead (kind of)

Sorry, if sample is not clear. Let me re-write it

SignInFilter {

        sessionOpened(NextFilter nextFilter, IoSession session) {
                // Since sign-in shake is required, do not call:
nextFilter.sessionOpened(session);
                session.write("You have to sign on"); // This message never be
received by remote server. Why???
        }

        messageReceived(NextFilter nextFilter, IoSession session, Object 
message) {
        // If sign in reply is received, allow connection to SocketHandler
        if (isSignInReply(message))
                        nextFilter.sessionOpened(session);
}



-- 
~The best men are men who benefit to others
http://michsan.web.id 一緒に勉強しましょう!

Yang berkualitas memang beda rasanya!
http://rizqi-cookies.com

Reply via email to