wxr
2020-12-17 014abc547ffd1a9f23c58fd7a471dffc5933fdd3
HDL_ON/DAL/DriverLayer/UdpSocket.cs
@@ -21,7 +21,7 @@
      //本地Socket
      private Socket busSocket;
      int _port = 0;
      public int Port = 0;
      /// <summary>
      /// 启动Socket接收和发送功能
      /// </summary>
@@ -29,7 +29,7 @@
        {
         if (IsRunning)
         {
                if (port == _port)
                if (port == Port)
                {
                    return;
                }
@@ -39,15 +39,15 @@
                }
            }
         if (port != 0)
            _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, 6000));
                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")));
         }