示例#1
0
        public void DoTest(string topic, object data)
        {
            using (UdpBus bus = new UdpBus("224.0.0.23", 40001))
            {

                object received = null;

                bus.Subscribe(topic, (o, e) =>
                   {
                       System.Diagnostics.Debug.WriteLine(e.DataObject.ToString());
                       received = e.DataObject;
                      Assert.AreEqual(data, received);
                   });

                bus.Start();

                bus.Publish(topic, data, 3000);

                System.Threading.Thread.Sleep(3000);
            }
        }
示例#2
0
 public Communication(string ip, int port)
 {
     bus = new UdpBus(ip, port);
     bus.Subscribe(Topics.CenterQuery, OnCenterQuery);
 }