From f5ba05c33393e55de28db91433901600bfb0658f Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期五, 22 五月 2020 17:43:11 +0800 Subject: [PATCH] 请合并最新代码「20200522:添加门锁晚上9点上报常开功能,优化PM2.5测试功能」 --- ZigbeeApp20200519/Shared/Phone/ZigBee/Common/Application.cs | 50 ++------------------------------------------------ 1 files changed, 2 insertions(+), 48 deletions(-) diff --git a/ZigbeeApp20200519/Shared/Phone/ZigBee/Common/Application.cs b/ZigbeeApp20200519/Shared/Phone/ZigBee/Common/Application.cs old mode 100755 new mode 100644 index ec0ce95..12f4207 --- a/ZigbeeApp20200519/Shared/Phone/ZigBee/Common/Application.cs +++ b/ZigbeeApp20200519/Shared/Phone/ZigBee/Common/Application.cs @@ -153,8 +153,8 @@ } } catch - { - //鍏抽棴Socket,涓嬫鍙戦�佷細鑷姩杩炴帴 + { + //鍏抽棴Socket,涓嬫鍙戦�佷細鑷姩杩炴帴 FindGateWaySocket.Stop(); } System.Threading.Thread.Sleep(500); @@ -334,10 +334,6 @@ { //鏈湴Socket public static Socket busSocket; - /// <summary> - /// 璁℃椂鍣� - /// </summary> - private static int timeCount = 0; /// <summary> /// 鍚姩Socket鎺ユ敹鍜屽彂閫佸姛鑳� @@ -395,52 +391,10 @@ { try { - //妫�娴嬭繛鎺ョ姸鎬� - CheckConnectiton(); - Start(7624); busSocket.BeginSendTo(bytes, 0, bytes.Length, SocketFlags.None, iPEndPoint, new AsyncCallback(asyncEndSend), null); } catch { } - } - - /// <summary> - /// 妫�娴嬭繛鎺ョ姸鎬� - /// </summary> - private static void CheckConnectiton() - { - if (busSocket == null) { return; } - timeCount++; - if (timeCount < 20) - { - //姣�10绉掓娴嬩竴娆� - return; - } - timeCount = 0; - - bool blockingState = busSocket.Blocking; - try - { - byte[] tmp = new byte[1]; - - busSocket.Blocking = false; - busSocket.Send(tmp, 0, 0); - //tcp杩樺湪杩炴帴鐫� - busSocket.Blocking = blockingState; - } - catch (SocketException e) - { - // 10035 == WSAEWOULDBLOCK - if (e.NativeErrorCode.Equals(10035)) - { - //Still Connected, but the Send would block - } - else - { - //tcp宸茬粡鏂紑浜嗚繛鎺� - Stop(); - } - } } /// <summary> -- Gitblit v1.8.0