コード例 #1
0
ファイル: NewTopicPub.cs プロジェクト: jinyuttt/ObserverDDS
        /// <summary>
        /// 广播新主题
        /// </summary>
        /// <param name="topic"></param>
        public void SendNewTopic(string topic)
        {
            MulticastSocket multicast = new MulticastSocket();
            int             num       = WaitNum;
            var             bytes     = DataPack.PackNewTopic(topic, LocalNode.NodeId, LocalNode.TopicAddress);

            while (!NodeListener.Instance.IsComplete(topic))
            {
                num--;
                multicast.SendTo(bytes);
                Thread.Sleep(50);
                if (num < 0)
                {
                    break;
                }
            }
            //组播信息需要桥接
            PTPMultCast.Instance.Send(bytes);
            multicast.Close();
        }