本文整理汇总了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);
}
}
示例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");
}