int zmq_msg_send (zmq_msg_t '*msg', void '*socket', int 'flags')
该api用于发送消息.
fkags:
ZMQ_SNDMORE: 指示着,该消息有多个帧
ZMQ_FONTWAIT: 指示着,该操作的是非阻塞的操作
成功返回的是接受到的字节数, 失败返回的是-1.
example:
/* Create a new message, allocating 6 bytes for message content */
zmq_msg_t msg;
int rc = zmq_msg_init_size (&msg, 6);
assert (rc == 0);
/* Fill in message content with 'AAAAAA' */
memset (zmq_msg_data (&msg), 'A', 6);
/* Send the message to the socket */
rc = zmq_msg_send (&msg, socket, 0);
assert (rc == 6);
----
.Sending a multi-part message
----
/* Send a multi-part message consisting of three parts to socket */
rc = zmq_msg_send (&part1, socket, ZMQ_SNDMORE);
rc = zmq_msg_send (&part2, socket, ZMQ_SNDMORE);
/* Final part; no more parts to follow */
rc = zmq_msg_send (&part3, socket, 0);
最后
以上就是小巧蜜粉最近收集整理的关于zmq_msg_send的全部内容,更多相关zmq_msg_send内容请搜索靠谱客的其他文章。
发表评论 取消回复