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


C# ZmqSocket.SendMessage方法代码示例

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


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

示例1: SendRequest

        public static void SendRequest(Int32 request,ref ZmqSocket socket)
        {
            //ZmqSocket socket;
            try
            {
                //socket = CreateSocket();

                var message = new ZmqMessage();
                message.Append(Encoding.UTF8.GetBytes(String.Format(" Hello {0}.", request)));

                socket.SendMessage(message);

                // TODO: add receive timeout as param
                var dataResult = socket.ReceiveMessage();

                Console.WriteLine(Encoding.UTF8.GetString(dataResult[0]));
                Console.WriteLine(Encoding.UTF8.GetString(dataResult[1]));

            }
            catch (Exception ex)
            {
                socket.Close();
                socket = CreateSocket();
                Console.WriteLine(ex.ToString());
            }
        }
开发者ID:maslakov,项目名称:zmqtests,代码行数:26,代码来源:Program.cs

示例2: SendMessage

 public static void SendMessage(byte[] address, byte[] message, ZmqSocket socket)
 {
     ZmqMessage zmqMessage = new ZmqMessage();
     zmqMessage.Append(new Frame(address));
     zmqMessage.Append(new Frame(message));
     socket.SendMessage(zmqMessage);
 }
开发者ID:yonglehou,项目名称:Daytona,代码行数:7,代码来源:Program.cs

示例3: GrapevineSender

        public GrapevineSender(ZmqContext context, string address, IMessageSerializer serializer)
        {
            _serializer = serializer;
            _scheduler = new EventLoopScheduler();

            _socket = context.CreateSocket(SocketType.PUB);
            _socket.Connect(address);

            _messages = new Subject<ZmqMessage>();
            _messageDispatcher = _messages
                .SubscribeOn(_scheduler)
                .ObserveOn(_scheduler)
                .Subscribe(msg => _socket.SendMessage(msg));
        }
开发者ID:xpando,项目名称:GrapevineZMQ,代码行数:14,代码来源:GrapevineSender.cs

示例4: SendUpdateMessage

 private static void SendUpdateMessage(ISolutionStrategy strategy, ProblemUpdateType updateType, ZmqSocket socket, IFrameable data)
 {
     ZmqMessage message = GetUpdateMessage(strategy, updateType, data);
     socket.SendMessage(message);
 }
开发者ID:eudaimos,项目名称:WaterBucket,代码行数:5,代码来源:WorkerRole.cs


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