You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Mark Wallsgrove <ma...@googlemail.com> on 2009/10/02 02:15:03 UTC
Disconnecting and Reconnecting to new Host
Hey :)
I am using Mina for a social networking client (MSN, ICQ, IRC, AOL,
etc). Currently I have got to the stage where I need to be able to
disconnect from the current connection and reconnect to a new host
(Redirection from switchboard). How is this possible from the
IoHandleAdaptor? Surely this should be rather simple?
I am currently using Mina 1.1.7.
Thank you for any replies
--
Best Regards,
Mark Wallsgrove
Re: Disconnecting and Reconnecting to new Host
Posted by Mark Wallsgrove <ma...@googlemail.com>.
Hey DR,
Thanks for the reply. I believe I have figured out what I need. What I
needed to do is disconnect from the current connection and connect to
a new server. I have done this by passing in the SocketConnector into
IoHandlerAdapter constructor so that I can redirect the connection.
I am currently testing/writing my code so I shall report later if it
worked. A simple problem deserves a simple solution. I haven't a clue
how I missed that one!
Best Regards,
Mark Wallsgrove
2009/10/2 David Rosenstrauch <da...@darose.net>:
> On 10/01/2009 08:15 PM, Mark Wallsgrove wrote:
>>
>> Hey :)
>>
>> I am using Mina for a social networking client (MSN, ICQ, IRC, AOL,
>> etc). Currently I have got to the stage where I need to be able to
>> disconnect from the current connection and reconnect to a new host
>> (Redirection from switchboard). How is this possible from the
>> IoHandleAdaptor? Surely this should be rather simple?
>>
>> I am currently using Mina 1.1.7.
>> Thank you for any replies
>
> Not sure I understand the problem. If you want the server to disconnect the
> connection, you'd do it like so:
>
> public class YourHandler extends IoHandlerAdapter {
> public void messageReceived(IoSession session, Object message) throws
> Exception {
> String messageStr = message.toString();
> if (messageStr.equals("disconnect")) {
> session.close();
> }
> }
> }
>
>
> Is there more to what you're trying to do than that?
>
> DR
>
--
Best Regards,
Mark Wallsgrove
Re: Disconnecting and Reconnecting to new Host
Posted by David Rosenstrauch <da...@darose.net>.
On 10/01/2009 08:15 PM, Mark Wallsgrove wrote:
> Hey :)
>
> I am using Mina for a social networking client (MSN, ICQ, IRC, AOL,
> etc). Currently I have got to the stage where I need to be able to
> disconnect from the current connection and reconnect to a new host
> (Redirection from switchboard). How is this possible from the
> IoHandleAdaptor? Surely this should be rather simple?
>
> I am currently using Mina 1.1.7.
> Thank you for any replies
Not sure I understand the problem. If you want the server to disconnect
the connection, you'd do it like so:
public class YourHandler extends IoHandlerAdapter {
public void messageReceived(IoSession session, Object message) throws
Exception {
String messageStr = message.toString();
if (messageStr.equals("disconnect")) {
session.close();
}
}
}
Is there more to what you're trying to do than that?
DR