You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Johannes U. Jensen" <sp...@daimi.au.dk> on 2006/09/06 23:18:09 UTC

Getting an IP from an IOSession

Hi,

I have implemented a StreamIoHandler, and when I receive a 
sessionOpened() I would like to get the ip. I have looked at the 
IOSession object but it only seems to be able to return a SocketAddress 
which doesnt have any methods. How do I get the IP ?

Regards,
Johannes U. Jensen

Re: Getting an IP from an IOSession

Posted by Greg Duffy <gd...@gmail.com>.
You need to downcast SocketAddress to InetSocketAddress.

InetSocketAddress isa = (InetSocketAddress) sa;

HTH,
Greg

On 9/6/06, Johannes U. Jensen <sp...@daimi.au.dk> wrote:
> Hi,
>
> I have implemented a StreamIoHandler, and when I receive a
> sessionOpened() I would like to get the ip. I have looked at the
> IOSession object but it only seems to be able to return a SocketAddress
> which doesnt have any methods. How do I get the IP ?
>
> Regards,
> Johannes U. Jensen
>