Hi all,
today I had a quick first look at the issue of implementing (or rather
continuing the existing work for) the DHCP protocol support. The notion
was that DHCP can't be completed until mina supports broadcast.
Well, I feel this might end up as the most stupid question in this (and
several other) mailing-list's history, but what I see is that
- there is already some code in place to support broadcast in MINA, e.g.
the line
ch.socket().setBroadcast( cfg.isBroadcast() );
in DatagramAcceptorDelegate.registerNew().
- if one configures the MINA server like this:
IoAcceptor acceptor = new DatagramAcceptor();
IoAcceptorConfig config = new DatagramAcceptorConfig();
((DatagramSessionConfigImpl)config.getSessionConfig()).setBroadcast(true);
acceptor.bind(
new InetSocketAddress( 67 ),
new DhcpProtocolHandler(),
config );
the server receives broadcasts just fine.
- sending data to the broadcast address worked for me, too, with minimal
changes to DhcpProtocolHandler.messageReceived():
InetSocketAddress inetSocketAddress = new InetSocketAddress(
InetAddress.getByName("255.255.255.255"), PORT);
ConnectFuture future = connector.connect(inetSocketAddress,
new DhcpProtocolHandler());
After all, I don't see that broadcast doesn't work with NIO. What
doesn't work with NIO, however, (at least as I see it) is multicast. But
multicast is a totally different beast and not required for DHCP.
So, well, the question is: as this sounds too good, to be true - what
did I miss?
Joerg Henne