当前位置: 首页>>代码示例>>C#>>正文


C# ZmqSocket.SubscribeAll方法代码示例

本文整理汇总了C#中ZmqSocket.SubscribeAll方法的典型用法代码示例。如果您正苦于以下问题:C# ZmqSocket.SubscribeAll方法的具体用法?C# ZmqSocket.SubscribeAll怎么用?C# ZmqSocket.SubscribeAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZmqSocket的用法示例。


在下文中一共展示了ZmqSocket.SubscribeAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateReceiveSocket

        public void CreateReceiveSocket()
        {
            m_SubscribeSocket = m_Context.CreateSocket(SocketType.SUB);

            m_SubscribeSocket.SubscribeAll();
            m_SubscribeSocket.Connect("epgm://239.1.1.1:9500");
            m_SubscribeSocket.Bind("tcp://*:9501");
            m_SubscribeSocket.Connect("inproc://Local");
        }
开发者ID:jystic,项目名称:Triangles-in-space,代码行数:9,代码来源:MessageReceiver.cs

示例2: SetupController

 private void SetupController(ZmqSocket controller)
 {
     controller.SubscribeAll();
     controller.Connect("inproc://controller");
     controller.ReceiveReady += (x, y) =>
     {
         //Console.WriteLine("I'm done for the day");
         _work = false;
     };
 }
开发者ID:keithbloom,项目名称:blogposts-zeromq,代码行数:10,代码来源:TaskWorker.cs

示例3: processMessages

        /// <summary>
        /// Processes the incoming message queue.
        /// </summary><remarks>
        /// Runs on a worker thread.
        /// </remarks>
        private void processMessages()
        {
            // We create a socket to receive messages from the
            // Python server...
            m_receiveSocket = m_context.CreateSocket(SocketType.SUB);
            m_receiveSocket.Connect("tcp://localhost:12345");
            m_receiveSocket.SubscribeAll();

            TimeSpan timeout = new TimeSpan(0, 0, 0, 0, 1);
            while (m_stopThread == false)
            {
                // We see if there is a message...
                int bytesReceived = m_receiveSocket.Receive(m_buffer, timeout);
                if (bytesReceived == -1)
                {
                    // There was no message in the queue...
                    continue;
                }

                // We got a message, so we decode it...
                switch (m_buffer[0])
                {
                    case 0:
                        // The 'Hello' message from the server...
                        handleHelloMessage();
                        break;

                    case 1:
                        // The start-of-tournament message...
                        decodeStartOfTournamentMessage(bytesReceived);
                        break;

                    case 2:
                        // The start-of-game message...
                        Utils.raiseEvent(StartOfGameEvent, this, null);
                        break;

                    case 3:
                        // The player-info message...
                        decodePlayerInfoMessage(bytesReceived);
                        break;

                    case 4:
                        // The board-update message...
                        decodeBoardUpdateMessage(bytesReceived);
                        break;

                    default:
                        // An unknown message (or maybe the "Hello" message after
                        // we connect. We ignore this...
                        break;
                }
            }

            // We close the socket before exiting the thread...
            m_receiveSocket.Linger = new TimeSpan(0);
            m_receiveSocket.Dispose();
        }
开发者ID:kkanagal,项目名称:monopyly,代码行数:63,代码来源:MessagingClient.cs


注:本文中的ZmqSocket.SubscribeAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。