From ed3bfb7462d44747230437717e8673a5192f833f Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 30 十一月 2020 20:34:51 +0800 Subject: [PATCH] 2020-11-30-2 --- HDL_ON/DriverLayer/Control_TcpClient.cs | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/Control_TcpClient.cs b/HDL_ON/DriverLayer/Control_TcpClient.cs similarity index 93% rename from HDL_ON/DAL/DriverLayer/Control_TcpClient.cs rename to HDL_ON/DriverLayer/Control_TcpClient.cs index aa8aeff..f3ad0a0 100644 --- a/HDL_ON/DAL/DriverLayer/Control_TcpClient.cs +++ b/HDL_ON/DriverLayer/Control_TcpClient.cs @@ -7,7 +7,6 @@ { public class Control_TcpClient { - //澹版槑IP锛岀鍙o紝鍜屼竴涓敤鏉ヨ繛鎺ョ殑Socket public string _ip; @@ -37,11 +36,10 @@ { _tcpClient.Connect(IPAddress.Parse(_ip), _port); Task.Run(new Action(ReceiveMessage));//寮�鍚嚎绋嬶紝涓嶅仠鎺ユ敹娑堟伅 - MainPage.Log($"鎵撳紑tcp client{_ip}:{_port}"); } catch (Exception e) { - MainPage.Log(e.Message); + Console.WriteLine(e); throw; } return true;//杩斿洖杩炴帴鐘舵�� @@ -66,11 +64,7 @@ public void SendMessage(byte[] bytes) { NetworkStream networkStream = _tcpClient.GetStream(); - if (networkStream.CanWrite) - { - networkStream.Write(bytes, 0, bytes.Length); - } - //networkStream.Close(); + networkStream.Write(bytes, 0, bytes.Length); } /// <summary> @@ -125,10 +119,8 @@ // MainPage.Log($"鎺ユ敹鏈嶅姟绔暟鎹�:{tcpDataString}"); //} - } } - } } \ No newline at end of file -- Gitblit v1.8.0