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


C# NetMQSocket.SendMore方法代码示例

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


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

示例1: AcceptDataAdditionRequest

        /// <summary>
        /// Handles incoming data "push" requests: the client sends data for us to add to local storage.
        /// </summary>
        private void AcceptDataAdditionRequest(string requesterIdentity, NetMQSocket socket)
        {
            //final message part: receive the DataAdditionRequest object
            bool hasMore;
            var ms = new MemoryStream();
            byte[] buffer = socket.Receive(out hasMore);

            var request = MyUtils.ProtoBufDeserialize<DataAdditionRequest>(buffer, ms);

            //log the request
            Log(LogLevel.Info, string.Format("Received data push request for {0}.",
                request.Instrument.Symbol));

            //start building the reply
            socket.SendMore(requesterIdentity);
            socket.SendMore("PUSHREP");
            try
            {
                _broker.AddData(request);
                socket.Send("OK");
            }
            catch (Exception ex)
            {
                socket.SendMore("ERROR");
                socket.Send(ex.Message);
            }
        }
开发者ID:ychaim,项目名称:qdms,代码行数:30,代码来源:HistoricalDataServer.cs

示例2: AcceptAvailableDataRequest

        /// <summary>
        /// Handles requests for information on data that is available in local storage
        /// </summary>
        private void AcceptAvailableDataRequest(string requesterIdentity, NetMQSocket socket)
        {
            //get the instrument
            bool hasMore;
            var ms = new MemoryStream();
            byte[] buffer = socket.Receive(out hasMore);

            var instrument = MyUtils.ProtoBufDeserialize<Instrument>(buffer, ms);

            //log the request
            Log(LogLevel.Info, string.Format("Received local data storage info request for {0}.",
                instrument.Symbol));

            //and send the reply

            var storageInfo = _broker.GetAvailableDataInfo(instrument);
            socket.SendMore(requesterIdentity);
            socket.SendMore("AVAILABLEDATAREP");

            socket.SendMore(MyUtils.ProtoBufSerialize(instrument, ms));

            socket.SendMore(BitConverter.GetBytes(storageInfo.Count));
            foreach (StoredDataInfo sdi in storageInfo)
            {
                socket.SendMore(MyUtils.ProtoBufSerialize(sdi, ms));
            }
            socket.Send("END");
        }
开发者ID:ychaim,项目名称:qdms,代码行数:31,代码来源:HistoricalDataServer.cs


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