DatagramChannel.send

本文介绍了一个公共抽象方法send,该方法用于在非阻塞模式下将剩余字节从给定缓冲区作为单一数据报发送到指定目标地址。如果底层输出缓冲区有足够的空间或者在阻塞模式下空间变得足够,则执行此操作。返回值为发送的字节数,可能是源缓冲区中剩余的字节数,也可能是在非阻塞模式下由于输出缓冲区空间不足而为零。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

send

public abstract int send
(ByteBuffer
 src,
SocketAddress  target)
throws IOException

non-blocking mode

and

there is sufficient room in the underlying output buffer

 

or

 

blocking mode

and

sufficient room becomes available

 

then the remaining bytes in the given buffer are transmitted as a single datagram to the given target address.


Returns:
The number of bytes sent, which will be either the number of bytes that were remaining in the source buffer when this method was invoked or, if this channel is non-blocking, may be zero if there was insufficient room for the datagram in the underlying output buffer
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值