From 489d3bd60ad7dc2fecb398b09cf4c52df16f0fc2 Mon Sep 17 00:00:00 2001 From: Davin <591807572@qq.com> Date: 星期三, 26 七月 2023 15:55:30 +0800 Subject: [PATCH] Merge branch 'Dev-Branch' of http://59.41.255.150:6688/r/~wxr/OnPro into Dev-Branch --- HDL_ON/DAL/DriverLayer/UdpSocket.cs | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/UdpSocket.cs b/HDL_ON/DAL/DriverLayer/UdpSocket.cs index 4f78319..36637f9 100644 --- a/HDL_ON/DAL/DriverLayer/UdpSocket.cs +++ b/HDL_ON/DAL/DriverLayer/UdpSocket.cs @@ -50,8 +50,10 @@ busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188"))); } - catch{ - busSocket = null; + catch (Exception ex){ + MainPage.Log ($"udp port bind error : {ex.Message}"); + + busSocket = null; return; } @@ -75,7 +77,7 @@ } catch { } busSocket = null; - MainPage.Log("Socket鍏抽棴"); + MainPage.Log("Socket鍏抽棴"); } /// <summary> @@ -120,9 +122,12 @@ { return; } - try { + if (busSocket == null) + { + return; + } asyncBeginReceive(); Packet packet = (Packet)iar.AsyncState; int len = busSocket.EndReceiveFrom(iar, ref packet.RemoteEndPoint); @@ -137,10 +142,11 @@ { Control.Ins.ConvertReceiveData(bytes, ((IPEndPoint)packet.RemoteEndPoint).Address.ToString()); } - else if(((IPEndPoint)packet.RemoteEndPoint).Port == 6000)//澶勭悊bus 6000绔彛鐨勬暟鎹� + else if (((IPEndPoint)packet.RemoteEndPoint).Port == 6000)//澶勭悊bus 6000绔彛鐨勬暟鎹� { packet.Manager(); } + } catch (Exception ex) { -- Gitblit v1.8.0