/**
* 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
*/
public int send(final ByteBuffer buffer)
{
int bytesSent = 0;
if (null != sendDatagramChannel)
{
final int bytesToSend = buffer.remaining();
if (null == multiDestination)
{
try
{
presend(buffer, connectAddress);
bytesSent = sendDatagramChannel.write(buffer);
}
catch (final PortUnreachableException | ClosedChannelException | NotYetConnectedException ignore)
{
}
catch (final IOException ex)
{
throw new RuntimeException("Failed to send packet of length: " + bytesToSend, ex);
}
}
else
{
bytesSent = multiDestination.send(sendDatagramChannel, buffer, this, bytesToSend);
}
}
return bytesSent;
}
SendChannelEndpoint.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:aeron
作者:
评论列表
文章目录