Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading;
- using ZMQ;
- namespace HwmClient
- {
- class Program
- {
- static void Main(string[] args)
- {
- Context context = new Context(1);
- Socket subSocket = context.Socket(SocketType.SUB);
- subSocket.Subscribe(string.Empty, Encoding.UTF8);
- subSocket.HWM = 10;
- subSocket.Connect("tcp://127.0.0.1:5555");
- int expectedMsgId = 1;
- while (true)
- {
- string msg = subSocket.Recv(Encoding.UTF8);
- int rxMsgId = int.Parse(msg);
- if (rxMsgId != expectedMsgId)
- {
- Console.WriteLine("Expected {0}, but received {1}", expectedMsgId, rxMsgId);
- }
- else
- {
- Console.WriteLine("Received expected message: {0,12}", rxMsgId);
- }
- expectedMsgId = rxMsgId + 1;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement