wei
2020-11-27 e53a1951d6aa07ad22aad9816da4703496fcbccd
HDL_ON/DAL/DriverLayer/UdpSocket.cs
@@ -21,20 +21,29 @@
      //本地Socket
      private Socket busSocket;
      int _port = 0;
      /// <summary>
      /// 启动Socket接收和发送功能
      /// </summary>
      public void Start (int port)
        {
            if (IsRunning ) {
                return;
            }
         if (IsRunning)
         {
            if (port == _port)
            {
               return;
                }
                else
                {
               busSocket.Close();
                }
         }
         _port = port;
            busSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            busSocket.EnableBroadcast = true;
            try {
                busSocket.Bind (new IPEndPoint (IPAddress.Any, 6000));
                busSocket.Bind (new IPEndPoint (IPAddress.Any, port));
            busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188")));
         }
@@ -119,7 +128,7 @@
            packet.Bytes = new byte[len];
            Array.Copy(bytes, 0, packet.Bytes, 0, packet.Bytes.Length);
            MainPage.Log($"接收IP{packet.RemoteEndPoint}数据");
            //MainPage.Log($"接收{packet.RemoteEndPoint}数据");
            //mqtt连接数据读取  A协议网络设备信息读取回复 处理
            if (((IPEndPoint)packet.RemoteEndPoint).Port == 8585)
            {