ZeroMq/NetMQ Не удается найти расширение ReceiveFrameBytes из ReceivingSocketExtensions

При публикации / подписке в NetMQ как я могу получить байты.

Я пытаюсь использовать расширение byte[] ReceiveFrameBytes() из ReceivingSocketExtensions, но я просто не вижу его intellisense.

Я использую NetMQ, который является пространством имен контейнера для расширения. Я использую пакет Nuget NetMq (не уверен, что он уместен - я предполагаю, что он совпадает с версией github)

http://netmq.readthedocs.org/en/latest/receiving-sending/

namespace WhoCares
{
    using NetMQ;    // the extension are in this namespace?
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading;

    public class Subscriber
    {
        private Thread        _coreThread;
        private NetMQContext  _context;
        private NetMQSocket  _socket;

        public bool IsRunning { get; private set; }

        public void Run()
        {               
            if (IsRunning)
                throw new InvalidOperationException("Already running");

            _context = NetMQContext.Create();
            _socket = _context.CreateSubscriberSocket();
            _socket.Options.ReceiveHighWatermark = 1000;
            _socket.Connect("tcp://localhost:12345");
            _socket.Subscribe("TopicA");

            IsRunning = true;

            Core();
        }


        private void Core()
        {
            _coreThread = Thread.CurrentThread;

            while (true)
            {              
                string messageReceived = _socket.ReceiveString();
                string bytesReceived = _socket.ReceiveString(); // I dont want a string..im sending bytesReceived

                // i want to use
                byte[] _socket.ReceiveFrameBytes();// COMPILER ERROR.. ITS IN THE EXTENSION ?
            }             
        }
    }   
}

Для решения проблемы используйте пакет NUGET

   _socket.ReceiveMessage().Pop().ToByteArray()

1 ответ

Решение

ReceiveFrameBytes - это новый API, доступный только в последнем предварительном выпуске от nuget или сборке от master. Попробуйте использовать Receive или ReceiveBytes.

Другие вопросы по тегам