Browse Source

代码优化

yinyujing 4 years ago
parent
commit
d49a6f6e30
1 changed files with 7 additions and 7 deletions
  1. 7 7
      NB_IOT_TCP_HP_SOCKET/MainForm_TCP.cs

+ 7 - 7
NB_IOT_TCP_HP_SOCKET/MainForm_TCP.cs

@@ -62,9 +62,6 @@ namespace NB_IOT_TCP_HP_SOCKET
                 server.OnClose += new ServerEvent.OnCloseEventHandler(OnClose);
                 server.OnShutdown += new ServerEvent.OnShutdownEventHandler(OnShutdown);
 
-                // 其他设置
-                // server.NoDelay = true;
-
                 SetAppState(AppState.UnStart);
             }
             catch (Exception ex)
@@ -378,8 +375,9 @@ namespace NB_IOT_TCP_HP_SOCKET
 
                 return HandleResult.Ok;
             }
-            catch (Exception)
+            catch (Exception ex)
             {
+                AddMsg(ex.Message, lbErrorData);
                 return HandleResult.Ignore;
             }
         }
@@ -514,8 +512,9 @@ namespace NB_IOT_TCP_HP_SOCKET
 
                         isHeartBeatRuning = false;
                     }
-                    catch (Exception)
+                    catch (Exception ex)
                     {
+                        AddMsg(ex.Message, lbErrorData);
                         isHeartBeatRuning = false;
                     }
                 }
@@ -620,8 +619,9 @@ namespace NB_IOT_TCP_HP_SOCKET
                     }
                     isTimeRuning = false;
                 }
-                catch (Exception)
+                catch (Exception ex)
                 {
+                    AddMsg(ex.Message, lbErrorData);
                     isTimeRuning = false;
                 }
 
@@ -813,7 +813,7 @@ namespace NB_IOT_TCP_HP_SOCKET
                 }
                 catch (Exception ex)
                 {
-                    LogUtil.WriteLog(ex.Message);
+                    AddMsg(ex.Message, lbErrorData);
                 }
             }
         }