Socket.this

Creates a new $(ZMQ) socket.

If context is not specified, the default _context (as returned by $(FREF defaultContext)) is used.

  1. this(SocketType type)
    struct Socket
    @safe
    this
  2. this(Context context, SocketType type)

Throws

ZmqException if $(ZMQ) reports an error.

Corresponds to

$(ZMQREF zmq_socket())

Examples

With default context:

auto sck = Socket(SocketType.push);
assert (sck.initialized);

With explicit context:

auto ctx = Context();
auto sck = Socket(ctx, SocketType.push);
assert (sck.initialized);

Meta