mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Fisk"...@lastbamboo.org>
Subject Re: DatagramConnector without connected UDP channel ?
Date Mon, 27 Aug 2007 23:03:12 GMT
One approach is to use an acceptor to listen on the *same local port* as the
connector and to set the setReuseAddress option on both the connector and
the acceptor.  SetReuseAddress basically means "set reuse local address", so
binding to the same local address multiple times doesn't create an error.

With this setup, the connector will receive all data from the address and
port it originally connected to, while the acceptor will receive all other
data (both from the server and anywhere else).

I've tested the above behavior thoroughly, and that's how it consistently
works.  The "connect" call basically tells the kernel "give me everything
from this address and port" while a straight acceptor can still receive
everything else from that same server with setReuseAddress.

Maybe not ideal, but "connect()" is pretty useful to limit traffic to only
that client and port.

Also, I'm not familiar with the TFTP port selection, but you could also use
a second connector if the second port is consistent.

The key to all of this is for the connector/acceptor or connector/connector
combo to share the same data classes underneath.

Hope that helps.


On 8/24/07, gui <janssk1@hotmail.com> wrote:
> Hi,
> I have noticed that the datagram connector always creates a connected UDP
> channel.
> I'm trying to create a MINA client that talks to TFTP server, but this
> server switches UDP ports.
> For instance, i'm sending a packet to the server on port 69, and the
> server
> replies to me from a different port. This behaviour is normal in the TFTP
> protocol.
> However, since MINA always uses connected UDP channels, I never recieve
> the
> response from the server. The packets don't get through the connected
> channel, since that one requires that all packets from the server come
> from
> the same port.
> Is there any way around this ?
> I have been looking in the MINA code but don't see a straightforward way
> to
> 'disconnect' the client UDP channel.
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/DatagramConnector-without-connected-UDP-channel---tf4325860s16868.html#a12320065
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message