DatagramChannel ch = null;
try
{
ch = DatagramChannel.open();
DatagramSessionConfig cfg;
if( req.config.getSessionConfig() instanceof DatagramSessionConfig )
{
cfg = ( DatagramSessionConfig ) req.config.getSessionConfig();
}
else
{
cfg = ( DatagramSessionConfig ) getDefaultConfig().getSessionConfig();
}
ch.socket().setReuseAddress( cfg.isReuseAddress() );
ch.socket().setBroadcast( cfg.isBroadcast() );
ch.socket().setReceiveBufferSize( cfg.getReceiveBufferSize() );
ch.socket().setSendBufferSize( cfg.getSendBufferSize() );
if( ch.socket().getTrafficClass() != cfg.getTrafficClass() )
{
ch.socket().setTrafficClass( cfg.getTrafficClass() );
}
ch.configureBlocking( false );
ch.socket().bind( req.address );
if( req.address == null || req.address.getPort() == 0 )