我目前正在尝试修改简单的 hwclient/hwserver 示例,以将具有预定义大小的字节数组发送到服务器。我已经看到基本上功能以以下形式给出:
public boolean send(byte[] data, int off, int length, int flags)
但似乎没有关于参数的文档int off
。谁能告诉我,这个参数有什么作用?
提前致谢
byte[]
如果您希望部分消费提及该数组索引的偏移量,则如果您希望完全被消费,则它始终为 0 。
/**
* Queues a message created from data, so it can be sent.
*
* @param data the data to send.
* @param off the index of the first byte to be sent.
* @param length the number of bytes to be sent.
* @param flags a combination (with + or |) of the flags defined below:
* </ul>
* @return true when it has been queued on the socket and ØMQ has assumed responsibility for the message.
* This does not indicate that the message has been transmitted to the network.
*/
public boolean send(byte[] data, int off, int length, int flags)