Guest User

Publisher

a guest
Jan 23rd, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.IO;
  5. using NetMQ;
  6. using System.Threading;
  7.  
  8. namespace Publisher
  9. {
  10.     class Program
  11.     {
  12.  
  13.         static void Main(string[] args)
  14.         {
  15.             byte[] array1 = new byte[1920 * 1080 * 4];            
  16.  
  17.             int msgNumber = 1;
  18.  
  19.             using (var context = NetMQContext.Create())
  20.             {
  21.                 using (var publisher = context.CreatePublisherSocket())
  22.                 {
  23.                     publisher.Options.SendHighWatermark = 1;
  24.                     publisher.Bind("tcp://*:5555");
  25.  
  26.                     while (true)
  27.                     {
  28.                         publisher.SendMore("TopicTest");
  29.                         publisher.Send(array1);
  30.                         msgNumber++;
  31.                         Console.WriteLine(msgNumber.ToString());
  32.                         Thread.Sleep(25);
  33.                     }
  34.                 }
  35.             }
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment