public int send(final ByteBuffer buffer)
    {
        int bytesSent = 0;

        if (null != sendDatagramChannel)
        {
            final int bytesToSend = buffer.remaining();

            if (null == multiDestination)
            {
                try
                {
                    sendHook(buffer, connectAddress);
                    if (sendDatagramChannel.isConnected())
                    {
                        bytesSent = sendDatagramChannel.write(buffer);
                    }
                }
                catch (final PortUnreachableException ignore)
                {
                }
                catch (final IOException ex)
                {
                    sendError(bytesToSend, ex, connectAddress);
                }
            }
            else
            {
                bytesSent = multiDestination.send(sendDatagramChannel, buffer, this, bytesToSend);
            }
        }

        return bytesSent;
    }
public int send ( final ByteBuffer buffer ) { int bytesSent = 0 ; if ( null != sendDatagramChannel ) { final int bytesToSend = buffer . remaining ( ) ; if ( null == multiDestination ) { try { sendHook ( buffer , connectAddress ) ; if ( sendDatagramChannel . isConnected ( ) ) { bytesSent = sendDatagramChannel . write ( buffer ) ; } } catch ( final PortUnreachableException ignore ) { } catch ( final IOException ex ) { sendError ( bytesToSend , ex , connectAddress ) ; } } else { bytesSent = multiDestination . send ( sendDatagramChannel , buffer , this , bytesToSend ) ; } } return bytesSent ; }
Send contents of a {@link ByteBuffer} to connected address.
This is used on the sender side for performance over send(ByteBuffer, SocketAddress).

@param buffer to send
@return number of bytes sent