You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Greg Duffy <gd...@gmail.com> on 2006/09/06 23:46:41 UTC

UDP, DIRMINA-162

Hi Trustin et. al,

A while back, I found and reported a bug in the Sun Java
DatagramChannel implementation that related to MINA, UDP, and
multihomed hosts. You can view it here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6431343.

It is currently listed as in progress, but you can see in the bug
comments that I was able to manually edit the Sun DatagramChannelImpl
(from the SCSL source bits) like so:

16d15
< import java.lang.ref.SoftReference;
42,46d40
<     // Cached InetAddress and port for unconnected DatagramChannels
<     // used by receive0
<     private InetAddress cachedSenderInetAddress = null;
<     private int cachedSenderPort = 0;
<
464,466d457
<           if (isConnected() && (localAddress == null)) {
<               // Socket was not bound before connecting,
<               // so ask what the address turned out to be
468c459
<           }
---
>
541,542d531
<                   cachedSenderInetAddress = isa.getAddress();
<                   cachedSenderPort = isa.getPort();

and it now works perfectly. Maybe Sun will apply my diff sometime, and
it will make it into Mustang :) Of course, YMMV (I haven't the domain
knowledge to know if I caused some other obscure bug by doing this),
but I thought it would be good for people who are using MINA (awesome)
but are stuck in the UDP world (not so awesome).

Also, I'd like to raise another issue. IMHO, the
ConnectionlessSessionTracker mentioned in DIRMINA-162 is an awesome
solution to bring the MINA datagram implementation on par with the TCP
implementation. Otherwise, the power of session attributes, etc. are
basically not available to those using UDP.

So [ steps off of soapbox, sorry about that :) ] is there anything I
can do to help get that implemented? Or is somebody already working on
it?

Thanks
-Greg