Socket.trySend

Sends a message frame.

_send blocks until the frame has been queued on the socket. trySend performs the operation in non-blocking mode, and returns a bool value that signifies whether the frame was queued on the socket.

The more parameter specifies whether this is a multipart message and there are _more frames to follow.

The char[] overload is a convenience function that simply casts the string argument to ubyte[].

  1. bool trySend(ubyte[] data, bool more)
    struct Socket
    @safe
    bool
    trySend
    (
    const ubyte[] data
    ,
    bool more = false
    )
  2. bool trySend(char[] data, bool more)
  3. bool trySend(Frame msg, bool more)
  4. this(SocketType type)
  5. this(Context context, SocketType type)

Throws

ZmqException if $(ZMQ) reports an error.

Corresponds to

$(ZMQREF zmq_send()) (with the ZMQ_DONTWAIT flag, in the case of trySend, and with the ZMQ_SNDMORE flag if more == true).

Examples

auto sck = Socket(SocketType.pub);
sck.send(cast(ubyte[]) [11, 226, 92]);
sck.send("Hello World!");

Meta