lith há 4 anos atrás
pai
commit
257e6e6fb5

+ 22 - 23
dotnet/Library/Sers/Sers.CL/Socket/Sers.CL.Socket.Iocp/DeliveryServer.cs

@@ -249,36 +249,35 @@ namespace Sers.CL.Socket.Iocp
         //
         private void ProcessReceive(SocketAsyncEventArgs e)
         {
+            //读取数据
+            DeliveryConnection conn = e.UserToken as DeliveryConnection;
+            if (conn == null) return;
+
+
             try
-            {
-                //读取数据
-                DeliveryConnection conn = (DeliveryConnection)e.UserToken;
-                if (conn != null)
+            {            
+
+                // check if the remote host closed the connection               
+                if (e.BytesTransferred > 0 && e.SocketError == SocketError.Success)
                 {
-                    // check if the remote host closed the connection               
-                    if (e.BytesTransferred > 0 && e.SocketError == SocketError.Success)
-                    {
-                        //读取数据
-                        conn.AppendData(new ArraySegment<byte>(e.Buffer, e.Offset, e.BytesTransferred));
-
-                        byte[] buffData = DataPool.BytesGet(receiveBufferSize);
-                        e.SetBuffer(buffData, 0, buffData.Length);
-
-                        // start loop
-                        //继续接收. 为什么要这么写,请看Socket.ReceiveAsync方法的说明
-                        if (!conn.socket.ReceiveAsync(e))
-                            ProcessReceive(e);
-                    }
-                    else
-                    {
-                        conn.Close();
-                    }
-                }
+                    //读取数据
+                    conn.AppendData(new ArraySegment<byte>(e.Buffer, e.Offset, e.BytesTransferred));
+
+                    byte[] buffData = DataPool.BytesGet(receiveBufferSize);
+                    e.SetBuffer(buffData, 0, buffData.Length);
+
+                    // start loop
+                    //继续接收. 为什么要这么写,请看Socket.ReceiveAsync方法的说明
+                    if (!conn.socket.ReceiveAsync(e))
+                        ProcessReceive(e);
+                    return;
+                } 
             }
             catch (Exception ex)
             {
                 Logger.Error(ex);
             }
+            conn.Close();
         }
 
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/Client/CLClient.csproj

@@ -10,7 +10,7 @@
     <Content Include="appsettings.json">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
-    <Content Include="StartClient.bat">
+    <Content Include="StartConsole.bat">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
   </ItemGroup>

+ 14 - 8
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/Client/ProgramQps.cs

@@ -1,10 +1,10 @@
 using System;
 using System.Collections.Generic;
 using System.Threading;
-using System.Threading.Tasks;
 using CLClient.Statistics;
 using Sers.Core.CL.CommunicationManage;
 using Vit.Core.Module.Log;
+using Vit.Core.Util.Threading;
 using Vit.Extensions;
 
 namespace CLClient
@@ -80,21 +80,27 @@ namespace CLClient
                 cm.SendMessageAsync(buff.BytesToByteData());
             }
 
-            for (int i = Vit.Core.Util.ConfigurationManager.ConfigurationManager.Instance.GetByPath<int>("PressureTest.requestThreadCount"); i > 0; i--)
-            {       
+            int theadCount = Vit.Core.Util.ConfigurationManager.ConfigurationManager.Instance.GetByPath<int>("PressureTest.requestThreadCount");
+
+            if (theadCount >= 0)
+            {
+                LongTaskHelp task = new LongTaskHelp();
+                task.threadName = "PressureTest.SendRequest";
+                task.threadCount = theadCount;
+                task.action = ()=> {
 
-                Task.Run(() =>
-                {
                     var conn = cm.organizeList[0].conn;
-                    for (;;)
+                    for (; ; )
                     {
                         if (conn.SendRequest(buff.BytesToByteData(), out _))
                             qpsInfo.IncrementRequest();
                     }
+                };
+                task.Start();
+            }
 
-                });
 
-            }
+ 
 
 
 

+ 0 - 0
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/Client/StartClient.bat → dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/Client/StartConsole.bat


+ 1 - 1
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/Server/CLServer.csproj

@@ -7,7 +7,7 @@
 
  
   <ItemGroup>
-    <Content Include="StartServer.bat">
+    <Content Include="StartConsole.bat">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
   </ItemGroup>

+ 0 - 0
dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/Server/StartServer.bat → dotnet/Library/Sers/Sers.CL/Test/CommunicationManage/Server/StartConsole.bat


+ 15 - 0
dotnet/Library/Sers/Sers.CL/Test/MessageDelivery/DeliveryClient/README.md

@@ -0,0 +1,15 @@
+
+#--------------------------------
+启动20个进程
+dotnet DeliveryClient.dll 192.168.10.11 4501 300 102 > console.log 2>&1 &
+
+qps为 三百万
+
+
+#--------------------------------
+启动20个进程
+dotnet DeliveryClient.dll 192.168.10.11 4501 300 512 > console.log 2>&1 &
+
+qps为 1百万
+
+实时网速为   读:500MB/s  写:500MB/s