wxr
2021-07-01 43b0d5870d528f23ecd6aeceb6cfd4325188b46f
HDL_ON/DAL/DriverLayer/UdpSocket.cs
@@ -21,29 +21,32 @@
      //本地Socket
      private Socket busSocket;
      int _port = 0;
      public int Port = 0;
      /// <summary>
      /// 启动Socket接收和发送功能
      /// </summary>
      public void Start (int port)
      public void Start (int port = 0)
        {
         if (IsRunning)
         {
            if (port == _port)
            {
               return;
                if (port == Port)
                {
                    return;
                }
                else
                {
               busSocket.Close();
                    busSocket.Close();
                }
         }
         _port = port;
            }
         if (port != 0)
            Port = port;
         if (Port == 0)
            return;
            busSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            busSocket.EnableBroadcast = true;
            try {
                busSocket.Bind (new IPEndPoint (IPAddress.Any, port));
            busSocket.Bind(new IPEndPoint(IPAddress.Any, Port));
            busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188")));
         }