我目前正在尝试修改简单的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)