ソースを参照

Remove useless logs.

justin.xing 3 年 前
コミット
43099a9635
3 ファイル変更10 行追加10 行削除
  1. 4 3
      KcpClientTest/Program.cs
  2. 0 4
      KcpNet/KcpConnection.cs
  3. 6 3
      KcpServerTest/Program.cs

+ 4 - 3
KcpClientTest/Program.cs

@@ -22,15 +22,16 @@ namespace KcpClientTest
                 {
                     Console.WriteLine("Ping respond.");
                 };
+                await SendStringAsync(client, $"哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈").ConfigureAwait(false);
                 var i = 0;
                 while (true)
                 {
                     i++;
                     try
                     {
-                        await SendStringAsync(client, $"[{i}]哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈").ConfigureAwait(false);
-                        //var result = await ReadStringAsync(client).ConfigureAwait(false);
-                        //Console.WriteLine($"Client [{client.Connection.Id}] received: " + result);
+
+                        var result = await ReadStringAsync(client).ConfigureAwait(false);
+                        Console.WriteLine($"Client [{client.Connection.Id}] received: " + result);
                     }
                     catch (Exception ex)
                     {

+ 0 - 4
KcpNet/KcpConnection.cs

@@ -139,10 +139,6 @@ namespace KcpNet
             }
 
             var type = (KcpPacketType) typeData[0];
-            if (type != KcpPacketType.Data)
-            {
-                Console.WriteLine($"Receive command {type}");
-            }
             switch (type)
             {
                 case KcpPacketType.PingRequest:

+ 6 - 3
KcpServerTest/Program.cs

@@ -65,9 +65,12 @@ namespace KcpServerTest
                         var length = BitConverter.ToInt32(lengthData, 0);
                         var data = await ReadServerBytesAsync(connection, length).ConfigureAwait(false);
                         Console.WriteLine($"Server connection [{connection.Id}] received: " + Encoding.UTF8.GetString(data));
-                        //var replyData = Encoding.UTF8.GetBytes("OK");
-                        //await connection.SendAsync(BitConverter.GetBytes(replyData.Length)).ConfigureAwait(false);
-                        //await connection.SendAsync(replyData).ConfigureAwait(false);
+                        while (true)
+                        {
+                            var replyData = Encoding.UTF8.GetBytes("OK");
+                            await connection.SendAsync(BitConverter.GetBytes(replyData.Length)).ConfigureAwait(false);
+                            await connection.SendAsync(replyData).ConfigureAwait(false);
+                        }
                     }
                 }
                 catch (Exception ex)