【问题标题】:ZMQ (Jeromq) - Missing parameter in socket send documentationZMQ (Jeromq) - 套接字发送文档中缺少参数
【发布时间】:2020-04-29 23:09:59
【问题描述】:

我目前正在尝试修改简单的 hwclient/hwserver 示例,以将具有预定义大小的字节数组发送到服务器。我已经看到基本上功能以以下形式给出:

public boolean send(byte[] data, int off, int length, int flags)

但似乎没有关于参数int off 的文档。谁能告诉我,这个参数有什么作用?

提前致谢

【问题讨论】:

    标签: java sockets zeromq jeromq


    【解决方案1】:

    如果你想要完整的 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)
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    • 2020-11-25
    • 1970-01-01
    • 1970-01-01
    • 2020-08-22
    • 1970-01-01
    相关资源
    最近更新 更多