Hi,
keep on code

@Override
    public void messageReceived(IoSession session, Object message) {
        TransportType transportType = session.getTransportType();
        InetSocketAddress address =
(InetSocketAddress)session.getLocalAddress();
        System.out.println(address.getAddress());
        System.out.println(address.getPort());
        if (transportType == TransportType.SOCKET) {
            System.out.println("tcp");
        } else if (transportType == TransportType.DATAGRAM) {
            System.out.println("udp");
        }
....
}

On Jan 29, 2008 5:27 AM, yangzhang <[EMAIL PROTECTED]> wrote:

>
> Relaying trustin's answer from FreeNode: session.getRemoteAddress(), since
> session is actually different for each unique source socket.
>
>
> yangzhang wrote:
> >
> > How do I get the source IP address and UDP port of a UDP packet received
> > in this fashion?
> >
> >     public final class Receiver extends IoHandlerAdapter {
> >         @Override
> >         public void messageReceived(IoSession session, Object obj)
> >                 throws Exception {
> > ...
> >
> > Thanks in advance!
> >
>
> --
> View this message in context:
> http://www.nabble.com/Getting-UDP-packet-source-tp15148498s16868p15155573.html
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>


-- 
________________________
Brenno Hayden F. Dantas

Reply via email to