Esempio n. 1
0
 private static void SendReceive(PairSocket s)
 {
     NanomsgSocketOptions.SetTimespan(s.SocketID, SocketOptionLevel.Default, SocketOption.RCVTIMEO, TimeSpan.FromMilliseconds(100));
     while (true)
     {
         var data = s.Receive();
         if (data != null)
         {
             Console.WriteLine("RECEIVED: '" + Encoding.UTF8.GetString(data) + "'");
         }
         Thread.Sleep(TimeSpan.FromSeconds(1));
         s.Send(Encoding.UTF8.GetBytes("the message is " + DateTime.Now.ToLongTimeString()));
     }
 }
Esempio n. 2
0
 public void Unsubscribe(byte[] topic)
 {
     NanomsgSocketOptions.SetBytes(SocketID, SocketOptionLevel.Subscribe, SocketOption.SUB_UNSUBSCRIBE, topic);
 }
Esempio n. 3
0
 public void Unsubscribe(string topic)
 {
     NanomsgSocketOptions.SetString(SocketID, SocketOptionLevel.Subscribe, SocketOption.SUB_UNSUBSCRIBE, topic);
 }