From e87985ec1dcb69beedaf9f95e8e7aba14b7c08d6 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 09 十二月 2020 18:50:14 +0800 Subject: [PATCH] 2020-12-09 1.信息中心,增加下划线和点击Alter提醒详情。 --- HDL_ON/DAL/DriverLayer/UdpSocket.cs | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/UdpSocket.cs b/HDL_ON/DAL/DriverLayer/UdpSocket.cs index 376e6bb..3ffb628 100644 --- a/HDL_ON/DAL/DriverLayer/UdpSocket.cs +++ b/HDL_ON/DAL/DriverLayer/UdpSocket.cs @@ -25,27 +25,31 @@ /// <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, 6000)); + busSocket.Bind(new IPEndPoint(IPAddress.Any, _port)); - busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188"))); + busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188"))); } catch{ busSocket = null; -- Gitblit v1.8.0