ZeroMq/NetMQ 无法从 ReceivingSocketExtensions 中找到扩展 ReceiveFrameBytes

ZeroMq/NetMQ Cannot find extension ReceiveFrameBytes from ReceivingSocketExtensions

当 publishing/subscribing 在 NetMQ 中时,我如何接收字节。

我正在尝试使用 ReceivingSocketExtensions 中的扩展 byte[] ReceiveFrameBytes(),但我就是看不到它的智能感知。

我正在使用 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()

ReceiveFrameBytes 是新的 API 仅在 nuget 的最新预发布版或 master 的构建中可用。尝试使用 Receive 或 ReceiveBytes。