本文整理汇总了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());
}
}
示例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);
}
示例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));
}
示例4: SendUpdateMessage
private static void SendUpdateMessage(ISolutionStrategy strategy, ProblemUpdateType updateType, ZmqSocket socket, IFrameable data)
{
ZmqMessage message = GetUpdateMessage(strategy, updateType, data);
socket.SendMessage(message);
}