public HostsPool(string announceIp, int port)
        {
            RaiseListChangedEvents = true;

            bus = new UdpBus(announceIp, port);

            bus.Subscribe(Topics.HostReply, HostMessageHandler);

            worker.DoWork += new DoWorkEventHandler(worker_DoWork);
            worker.WorkerSupportsCancellation = true;

            this.Observer = new NullHostsPoolObserver();
        }
Exemple #2
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);
            }
        }
 public Communication(string ip, int port)
 {
     bus = new UdpBus(ip, port);
     bus.Subscribe(Topics.CenterQuery, OnCenterQuery);
 }