Exemplo n.º 1
0
        protected SocketBase(Context Context, int BufferSize, SocketType Type)
        {
            NativeHandler = LibZmq.zmq_socket(Context, (int)Type);

            bufferSize = BufferSize;
            buffer     = Marshal.AllocHGlobal(bufferSize);
        }
Exemplo n.º 2
0
        public virtual byte[] Read()
        {
            int length = LibZmq.zmq_buffer_recv(NativeHandler, buffer, bufferSize, 0);

            if (length == 0)
            {
                return(null);
            }

            byte[] buf = new byte[length];
            Marshal.Copy(buffer, buf, 0, length);

            return(buf);
        }
Exemplo n.º 3
0
 public int Poll(PollItem[] pollItems, int timeoutMilliseconds)
 {
     return(LibZmq.zmq_poll(pollItems, pollItems.Length, timeoutMilliseconds * LibZmq.PollTimeoutRatio));
 }
Exemplo n.º 4
0
 public Context()
 {
     NativeHandler = LibZmq.zmq_ctx_new();
 }
Exemplo n.º 5
0
 public override void Dispose()
 {
     LibZmq.zmq_ctx_destroy(NativeHandler);
 }
Exemplo n.º 6
0
 public virtual void Write(byte[] Buffer)
 {
     Marshal.Copy(Buffer, 0, buffer, Buffer.Length);
     LibZmq.zmq_buffer_send(NativeHandler, buffer, Buffer.Length, 0);
 }
Exemplo n.º 7
0
 public virtual void Connect(string Address)
 {
     LibZmq.zmq_connect(NativeHandler, Address);
 }
Exemplo n.º 8
0
 public virtual void Bind(string Address)
 {
     LibZmq.zmq_bind(NativeHandler, Address);
 }
Exemplo n.º 9
0
 public override void Dispose()
 {
     Marshal.FreeHGlobal(buffer);
     LibZmq.zmq_close(NativeHandler);
 }