public static byte[] Receive([NotNull] this NetMQSocket socket, TimeSpan timeout)
        {
            var result = socket.Poll(PollEvents.PollIn, timeout);

            if (!result.HasFlag(PollEvents.PollIn))
            {
                return(null);
            }

            return(socket.Receive());
        }
Beispiel #2
0
        private void OnMessage(object sender, NetMQSocketEventArgs e)
        {
            // remove the awake command from the queue
            m_serverSocket.Receive();

            Task task;

            while (m_tasksQueue.TryDequeue(out task))
            {
                TryExecuteTask(task);
            }
        }
Beispiel #3
0
        private void OnMessage(object sender, NetMQSocketEventArgs e)
        {
            byte[] data = m_serverSocket.Receive();

            IntPtr address;

            // checking if 64bit or 32 bit
            if (data.Length == 8)
            {
                address = new IntPtr(BitConverter.ToInt64(data, 0));
            }
            else
            {
                address = new IntPtr(BitConverter.ToInt32(data, 0));
            }

            GCHandle handle = GCHandle.FromIntPtr(address);

            Task task = (Task)handle.Target;

            TryExecuteTask(task);

            handle.Free();
        }