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