From a5ba89efa83d0a4afd0d25dbeba5989e4944b5b8 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 24 十一月 2020 18:57:56 +0800 Subject: [PATCH] 20201124;mqtt代码整理备份 --- HDL_ON/DAL/DriverLayer/UdpSocket.cs | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/UdpSocket.cs b/HDL_ON/DAL/DriverLayer/UdpSocket.cs index 2e6343a..4258c9b 100644 --- a/HDL_ON/DAL/DriverLayer/UdpSocket.cs +++ b/HDL_ON/DAL/DriverLayer/UdpSocket.cs @@ -1,9 +1,8 @@ 锘縰sing System; using System.Net.Sockets; using System.Net; -using Newtonsoft.Json.Linq; -namespace HDL_ON +namespace HDL_ON.DriverLayer { public class UdpSocket { @@ -28,7 +27,7 @@ /// </summary> public void Start () { - if (IsRunning) { + if (IsRunning ) { return; } @@ -36,6 +35,7 @@ busSocket.EnableBroadcast = true; try { busSocket.Bind (new IPEndPoint (IPAddress.Any, 6000)); + busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188"))); } catch{ @@ -97,10 +97,6 @@ Console.WriteLine($"asyncBeginReceive {e.Message}"); } } - /// <summary> - /// 鎼滅储缃戠粶璁惧瑙﹀彂鐨勫洖璋冧簨浠� - /// </summary> - public Action<string> SearchNetDeviceAction; /// <summary> /// 寮傛鎺ユ敹鏁版嵁缁撴潫 @@ -126,7 +122,7 @@ //mqtt杩炴帴鏁版嵁璇诲彇 A鍗忚缃戠粶璁惧淇℃伅璇诲彇鍥炲 澶勭悊 if (((IPEndPoint)packet.RemoteEndPoint).Port == 8585) { - Common.A_Protocal_Common.apc.ConvertReceiveData(bytes); + DriverLayer.A_Protocal_Common.apc.ConvertReceiveData(bytes); } else if(((IPEndPoint)packet.RemoteEndPoint).Port == 6000)//澶勭悊bus 6000绔彛鐨勬暟鎹� { -- Gitblit v1.8.0