public void Disconnect(string endPoint) { CheckDisposed(); if (endPoint == null) { throw new ArgumentNullException(nameof(endPoint)); } LibZmq.zmq_disconnect(Handle, endPoint).ThrowIfLastError(); }
public void Receive(ZmqMessage message, ZmqSendReceiveFlags flags = ZmqSendReceiveFlags.None) { CheckDisposed(); if (message == null) { throw new ArgumentNullException(nameof(message)); } LibZmq.zmq_msg_recv(message.DangerousGetNativeMessage(), Handle, flags).ThrowIfLastError(); }
private void ReleaseUnmanagedResources() { try { LibZmq.zmq_msg_close(_nativeMessage).ThrowIfLastError(); } finally { Marshal.FreeHGlobal(_nativeMessage); _nativeMessage = IntPtr.Zero; } }
public ZmqMessage(int initialSize = 0) { if (initialSize < 0) { throw new ArgumentOutOfRangeException(nameof(initialSize)); } _nativeMessage = Marshal.AllocHGlobal(Marshal.SizeOf <LibZmq.zmq_msg_t>()); if (initialSize == 0) { LibZmq.zmq_msg_init(_nativeMessage).ThrowIfLastError(); } else { LibZmq.zmq_msg_init_size(_nativeMessage, new UIntPtr((uint)initialSize)).ThrowIfLastError(); } }
protected override int ReleaseZmqObject(IntPtr context) { return(LibZmq.zmq_ctx_term(context)); }
public ZmqSocket(ZmqContext context, ZmqSocketType socketType) { Context = context ?? throw new ArgumentNullException(nameof(context)); SocketType = socketType; Handle = LibZmq.zmq_socket(context.Handle, socketType).ThrowIfLastError(); }
public IntPtr DangerousGetData() { CheckDisposed(); return(LibZmq.zmq_msg_data(_nativeMessage)); }
protected override int ReleaseZmqObject(IntPtr socket) => LibZmq.zmq_close(socket);