Zeromq interface function: zmq_send_const– sends a fixed memory data from a socket

Source: Internet
Author: User
Tags creative commons attribution

ZeroMQ API directory :http://www.cnblogs.com/fengbohello/p/4230135.html

—————————————————————————————————————

ZeroMQ official address :http://api.zeromq.org/4-1:zmq-send-const

Zmq_send_const (3) ØMQ Manual-ømq/4.1.0

Name

zmq_send_const– send a fixed memory data from a socket

Synopsis

int zmq_send_const (voidvoidint flags);

Description

The Zmq_send_const () function adds a message created through the BUF parameter and the Len parameter to the message queue of the socket. The message memory is considered to be a fixed space and is not copied or released in any way. The flags parameter is a combination of the flags defined below:

  Zmq_dontwait

When some socket types (DEALER, PUSH) are not available on the peer (or all of the peers reach the high watermark), this option specifies that the operation is performed in a non-blocking manner. If the message queue cannot be added to the socket, the Zmq_send_const () function executes the error and sets the value of errno to Eagain.

  Zmq_sndmore

Indicates that the currently sent message is a multi-frame message, and there will be more frames for the message to be sent. See the section on multi-message descriptions below for more information.

A successful call to the Zmq_send_const () function does not indicate that the message has been sent to the network, but that the message has been added to the message queue and ZMQ will be responsible for the message.

multi-part messages

A ZMQ message consists of one or more message frames. The ZMQ guarantees that the message will be delivered automatically: either end receives the message completely or does not receive the message at all. There is no limit to the total number of frames for the message, as long as the memory is sufficient.

When the application process sends a multi-frame message, it must use the ZMQ_SNDMORE flag when it sends the last frame.

Return value

If the function Zmq_send_const () executes successfully, the number of bytes of the message is returned. Otherwise, the function returns-1, and sets the value of errno to the value defined below.

Errors

  Eagain

When non-blocking mode is sent, the message cannot be sent at this moment.

  Enotsup

The Zmq_send_const () function does not support the type of this socket.

  EFSM

The Zmq_send_const () operation cannot be operated on this socket at this time because the socket is in an inappropriate state at the moment. This error often occurs on socket types that are often exchanged between several states, such as Zmq_rep. See the message Mode section of the Zmq_socket (3) function for more information.

  Eterm

The context associated with the specified socket is terminated.

  Enotsock

The socket provided by the parameter cannot be used.

  Eintr

The operation was interrupted by a signal before the message was sent.

  Ehostunreach

The message could not be routed.

Example

Send a multi-frame message

/*Send a multi-part message consisting of three parts to socket*/RC= Zmq_send_const (Socket,"ABC",3, Zmq_sndmore); Assert (RC==3); RC= Zmq_send_const (Socket,"DEFGH",5, Zmq_sndmore); Assert (RC==5);/*Final part; no more parts to follow*/RC= Zmq_send_const (Socket,"JK",2,0); ASSERT (RC==2);

See Also

Zmq_send (3) ZMQ_RECV (3) Zmq_socket (7) ZMQ (7)

Authors

This page is written by Theømq community. A change of THEØMQ contribution Policy at http://www.zeromq.org/docs:contributing.

WEB site design and content is copyright (c) 2007-2012 Imatix Corporation. Contact us for professional support. Site content licensed under the Creative Commons attribution-share alike 3.0 License. ØMQ is copyright (c) Copyright (c) 2007-2012 Imatix Corporation and Contributors. ØMQ is free software licensed

Under the LGPL. ØMQ, ZeroMQ, and 0MQ are trademarks of Imatix Corporation. Terms of Use-privacy

Policy

Translation: The Storm

Mail: [Email protected]

Zeromq interface function: zmq_send_const– sends a fixed memory data from a socket

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.