internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IAsynchronous> .Create(new Asynchronous())) { if (server.IsListen) { IAsynchronous client = AutoCSer.Net.TcpInternalServer.Emit.Client <IAsynchronous> .Create(); using (client as IDisposable) { sumWait.Reset(); int sum = 0; client.Add(2, 3, value => { if (value.Type == AutoCSer.Net.TcpServer.ReturnType.Success) { sum = value.Value; } sumWait.Set(); return(false); }); sumWait.WaitOne(); return(sum == 2 + 3); } } } return(false); }
internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IKeepCallback> .Create(new KeepCallback())) { if (server.IsListen) { IKeepCallback client = AutoCSer.Net.TcpInternalServer.Emit.Client <IKeepCallback> .Create(); using (client as IDisposable) { sumWait.Reset(); int count = 4, successCount = count; using (AutoCSer.Net.TcpServer.KeepCallback keepCallback = client.Add(2, 3, count, value => { if (value.Type == AutoCSer.Net.TcpServer.ReturnType.Success && value.Value == 2 + 3) { --successCount; } if (--count == 0) { sumWait.Set(); } return(false); })) { sumWait.WaitOne(); return(successCount == 0); } } } } return(false); }
/// <summary> /// 设置TCP服务端 /// </summary> /// <param name="tcpServer">TCP服务端</param> public override void SetTcpServer(AutoCSer.Net.TcpInternalServer.Server tcpServer) { base.SetTcpServer(tcpServer); cacheFile = AutoCSer.Config.Pub.Default.CachePath + ServerName + (ServerName == tcpServer.ServerName ? null : ("_" + tcpServer.ServerName)) + ".cache"; fromCacheFile(); PushNotNull(this); }
static void Main(string[] args) { bool createdProcessWait; EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.Nuget", out createdProcessWait); if (createdProcessWait) { Console.WriteLine(@"http://www.AutoCSer.com/TcpServer/InterfaceServer.html "); using (processWait) using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IServer> .Create(new Server())) { if (server.IsListen) { IServer client = AutoCSer.Net.TcpInternalServer.Emit.Client <IServer> .Create(); using (client as IDisposable) { Console.WriteLine(client.Add(2, 3) == 2 + 3); } } } Console.ReadKey(); } }
internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IInherit> .Create(new Inherit())) { if (server.IsListen) { IInherit client = AutoCSer.Net.TcpInternalServer.Emit.Client <IInherit> .Create(); using (client as IDisposable) { AutoCSer.Net.TcpServer.ReturnValue <int> sum = ((IInheritA)client).Add(2, 3); if (sum.Type != AutoCSer.Net.TcpServer.ReturnType.Success || sum.Value != 2 + 3 + 1) { return(false); } sum = ((IInheritB)client).Add(2, 3); if (sum.Type != AutoCSer.Net.TcpServer.ReturnType.Success || sum.Value != 2 + 3 + 2) { return(false); } sum = client.AddOnly(2, 3); if (sum.Type != AutoCSer.Net.TcpServer.ReturnType.Success || sum.Value != 2 + 3) { return(false); } return(true); } } } return(false); }
/// <summary> /// 客户端异步 await 测试 /// </summary> /// <returns></returns> internal static async System.Threading.Tasks.Task <bool> TestCaseAsync() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IClientAwaiterServer> .Create(new ClientAwaiter())) { if (server.IsListen) { IClientAwaiter client = AutoCSer.Net.TcpInternalServer.Emit.Client <IClientAwaiter> .Create(); using (client as IDisposable) { AutoCSer.Net.TcpServer.ReturnValue <int> sum = await client.Add(2, 3); if (sum.Type != AutoCSer.Net.TcpServer.ReturnType.Success || sum.Value != 2 + 3) { return(false); } sum2 = 0; AutoCSer.Net.TcpServer.ReturnValue returnValue = await client.Add2(3, 5); if (returnValue.Type != AutoCSer.Net.TcpServer.ReturnType.Success || sum2 != 3 + 5) { return(false); } return(true); } } } return(false); }
/// <summary> /// 设置TCP服务端 /// </summary> /// <param name="tcpServer">TCP服务端</param> public override void SetTcpServer(AutoCSer.Net.TcpInternalServer.Server tcpServer) { base.SetTcpServer(tcpServer); bool isError = false; cacheFile = ServerName + (ServerName == tcpServer.Attribute.ServerName ? null : ("_" + tcpServer.Attribute.ServerName)) + ".cache"; if (File.Exists(cacheFile)) { try { foreach (ProcessCopyer copyer in AutoCSer.BinarySerialize.DeSerializer.DeSerialize <ProcessCopyer[]>(File.ReadAllBytes(cacheFile))) { if (copyer.Guard(this)) { guards.Add(copyer.ProcessId, copyer); } else { isError = true; } } } catch (Exception error) { isError = true; tcpServer.Log.Add(AutoCSer.Log.LogType.Error, error); } if (isError) { saveCache(); } } }
/// <summary> /// 设置TCP服务端 /// </summary> /// <param name="tcpServer">TCP服务端</param> public override void SetTcpServer(AutoCSer.Net.TcpInternalServer.Server tcpServer) { base.SetTcpServer(tcpServer); cacheFile = ServerName + (ServerName == tcpServer.ServerAttribute.ServerName ? null : ("_" + tcpServer.ServerAttribute.ServerName)) + ".cache"; if (File.Exists(cacheFile)) { try { foreach (ProcessCopyer copyer in AutoCSer.BinaryDeSerializer.DeSerialize <ProcessCopyer[]>(File.ReadAllBytes(cacheFile))) { if (copyer.Guard(this)) { guards.Add(copyer.ProcessId, copyer); } else { saveCacheLock = 1; } } } catch (Exception error) { saveCacheLock = 1; tcpServer.Log.Exception(error, null, LogLevel.Exception | LogLevel.AutoCSer); } if (saveCacheLock != 0) { server.CallQueueLink.Add(new ProcessCopySaveCache(this)); } } }
static void Main(string[] args) { bool createdProcessWait; EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.Example.TcpRegisterClient", out createdProcessWait); if (createdProcessWait) { using (processWait) { Console.WriteLine(@"http://www.AutoCSer.com/TcpServer/Register.html "); try { AutoCSer.Threading.ThreadPool.TinyBackground.Start(clientThread); AutoCSer.Net.TcpInternalServer.Server server = null; RegisterClientTestServer test = new RegisterClientTestServer(); do { AutoCSer.Net.TcpInternalServer.Server newServer = AutoCSer.Net.TcpInternalServer.Emit.Server <IRegisterClientTestServer> .Create(test, AutoCSer.MemberCopy.Copyer <AutoCSer.Net.TcpInternalServer.ServerAttribute> .MemberwiseClone(serverAttribute)); if (newServer.IsListen) { if (server != null) { server.Dispose(); } server = newServer; Console.WriteLine(@" Version:" + test.Version.toString()); } else { Console.WriteLine(@" 测试服务启动失败"); } Thread.Sleep(5000); if (test.Version == 9) { Console.WriteLine(@" 测试结束"); isEnd = true; if (server != null) { server.Dispose(); } Console.ReadKey(); return; } ++test.Version; }while (true); } catch (Exception error) { Console.WriteLine(error.ToString()); } Console.ReadKey(); } } }
/// <summary> /// 缓存管理 /// </summary> /// <param name="slaveServer">缓存从服务</param> /// <param name="tcpServer">缓存服务</param> internal CacheManager(SlaveServer slaveServer, AutoCSer.Net.TcpInternalServer.Server tcpServer) { shortPaths = new ShortPathItem[slaveServer.Config.GetShortPathCount]; loadBuffer = new Buffer(); SlaveServer = slaveServer; TcpServer = tcpServer; Config = slaveServer.Config; CanWrite = false; }
internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IServer> .Create(new Server())) { if (server.IsListen) { return(testCase(AutoCSer.Net.TcpInternalServer.Emit.Client <IServer> .Create())); } } return(false); }
/// <summary> /// 设置TCP服务端 /// </summary> /// <param name="tcpServer">TCP服务端</param> public override void SetTcpServer(AutoCSer.Net.TcpInternalServer.Server tcpServer) { base.SetTcpServer(tcpServer); cacheFileName = AutoCSer.Config.Pub.Default.CachePath + ServerName + (ServerName == tcpServer.Attribute.ServerName ? null : ("_" + tcpServer.Attribute.ServerName)) + ".cache"; FileWatcher = new AutoCSer.IO.CreateFlieTimeoutWatcher(ProcessCopyer.Config.CheckTimeoutSeconds, this, AutoCSer.IO.CreateFlieTimeoutType.HttpServerRegister, tcpServer.Log); if (!AutoCSer.Config.Pub.Default.IsService && ProcessCopyer.Config.WatcherPath != null) { try { FileWatcher.Add(ProcessCopyer.Config.WatcherPath); } catch (Exception error) { tcpServer.Log.Add(AutoCSer.Log.LogType.Error, error, ProcessCopyer.Config.WatcherPath); } } try { if (System.IO.File.Exists(cacheFileName)) { Cache[] cache = AutoCSer.BinarySerialize.DeSerializer.DeSerialize <Cache[]>(System.IO.File.ReadAllBytes(cacheFileName)); isLoadCache = true; if (OnLoadCacheDomain != null) { OnLoadCacheDomain(); } for (int index = cache.Length; index != 0;) { try { start(ref cache[--index]); } catch (Exception error) { tcpServer.Log.Add(AutoCSer.Log.LogType.Error, error); } } } } catch (Exception error) { tcpServer.Log.Add(AutoCSer.Log.LogType.Error, error); } if (isLoadCache) { isLoadCache = false; } else if (OnLoadCacheDomain != null) { OnLoadCacheDomain(); } }
internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IServerAsynchronous> .Create(new ServerAsynchronous())) { if (server.IsListen) { IServerAsynchronousClient client = AutoCSer.Net.TcpInternalServer.Emit.Client <IServerAsynchronousClient> .Create(); using (client as IDisposable) { AutoCSer.Net.TcpServer.ReturnValue <int> sum = client.Add(2, 3); return(sum.Type == Net.TcpServer.ReturnType.Success && sum.Value == 2 + 3); } } } return(false); }
/// <summary> /// 断线重连测试 /// </summary> internal static void ConnectionTest() { IServer client = AutoCSer.Net.TcpInternalServer.Emit.Client <IServer> .Create(); using (client as IDisposable) { long value; AutoCSer.Net.TcpServer.ReturnType returnType; do { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IServer> .Create(new Server())) { if (server.IsListen) { value = LongValue; returnType = client.IncLong().Type; if (returnType == AutoCSer.Net.TcpServer.ReturnType.Success && LongValue == value + 1) { Console.Write('.'); } else { Console.WriteLine(@" " + returnType.ToString()); } } else { Console.WriteLine(@" Server is not listen"); } } returnType = client.IncLong().Type; if (returnType == AutoCSer.Net.TcpServer.ReturnType.ClientDisposed) { Console.Write('.'); } else { Console.WriteLine(@" " + returnType.ToString()); } }while (true); } }
static void Main(string[] args) { bool createdProcessWait; EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.TcpInternalServerPerformance.Emit", out createdProcessWait); if (createdProcessWait) { Console.WriteLine(@"http://www.AutoCSer.com/TcpServer/InterfaceServer.html "); using (processWait) using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IServer> .Create(new InternalServer())) { if (server.IsListen) { #if DEBUG FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\TcpClientPerformance\bin\Debug\AutoCSer.TestCase.TcpInternalClientPerformance.Emit.exe".pathSeparator())); #else FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\TcpClientPerformance\bin\Release\AutoCSer.TestCase.TcpInternalClientPerformance.Emit.exe".pathSeparator())); #endif if (!clientFile.Exists) { clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"AutoCSer.TestCase.TcpInternalClientPerformance.Emit.exe")); } if (clientFile.Exists) { Process.Start(clientFile.FullName); } else { Console.WriteLine("未找到 TCP 内部服务性能测试服务 客户端程序"); } Console.WriteLine("Press quit to exit."); while (Console.ReadLine() != "quit") { ; } } else { Console.WriteLine("TCP 内部服务性能测试服务 启动失败"); Console.ReadKey(); } } } }
internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IRefOut> .Create(new RefOut())) { if (server.IsListen) { IRefOut client = AutoCSer.Net.TcpInternalServer.Emit.Client <IRefOut> .Create(); using (client as IDisposable) { int right = 3, product; AutoCSer.Net.TcpServer.ReturnValue <int> sum = client.Add(2, ref right, out product); return(sum.Type == AutoCSer.Net.TcpServer.ReturnType.Success && sum.Value == 2 + 3 && right == (3 << 1) && product == 2 * 3); } } } return(false); }
internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <ISendOnly> .Create(new SendOnly())) { if (server.IsListen) { ISendOnly client = AutoCSer.Net.TcpInternalServer.Emit.Client <ISendOnly> .Create(); using (client as IDisposable) { sumWait.Reset(); sum = 0; client.SetSum(2, 3); sumWait.WaitOne(); return(sum == 2 + 3); } } } return(false); }
static void Main(string[] args) { #if DotNetStandard Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle"); #else bool createdProcessWait; EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.TcpInternalServerPerformance.Emit", out createdProcessWait); if (createdProcessWait) { using (processWait) { #endif Console.WriteLine(@"http://www.AutoCSer.com/TcpServer/InterfaceServer.html "); using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IServer> .Create(new InternalServer())) { if (server.IsListen) { if (!startProcess("TcpClientPerformance", "AutoCSer.TestCase.TcpInternalClientPerformance.Emit")) { Console.WriteLine("未找到 TCP 内部服务性能测试服务 客户端程序"); } Console.WriteLine("Press quit to exit."); while (Console.ReadLine() != "quit") { ; } } else { Console.WriteLine("TCP 内部服务性能测试服务 启动失败"); Console.ReadKey(); } } #if !DotNetStandard } } #endif }
/// <summary> /// 缓存管理 /// </summary> /// <param name="config">缓存服务配置</param> /// <param name="tcpServer">缓存服务</param> internal CacheManager(MasterServerConfig config, AutoCSer.Net.TcpInternalServer.Server tcpServer) { Config = config; TcpServer = tcpServer; tcpQueue = tcpServer.CallQueue; shortPaths = new ShortPathItem[config.GetShortPathCount]; if (config.IsFile) { disposeHandle = Dispose; IsFile = true; File = new FileStreamWriter(this, config); foreach (Cache.MessageQueue.Node messageQueue in LoadMessageQueues) { messageQueue.Start(); } LoadMessageQueues.SetNull(); IsLoaded = CanWrite = true; AutoCSer.DomainUnload.Unloader.Add(disposeHandle, DomainUnload.Type.Action); } else { IsLoaded = CanWrite = true; } }
static void Main(string[] args) { #if DotNetStandard Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle"); #else bool createdProcessWait; EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.Example.TcpRegisterClient", out createdProcessWait); if (createdProcessWait) { using (processWait) { #endif Console.WriteLine(@"http://www.AutoCSer.com/TcpServer/Register.html "); try { AutoCSer.Threading.ThreadPool.TinyBackground.Start(clientThread); AutoCSer.Net.TcpInternalServer.Server server = null; RegisterClientTestServer test = new RegisterClientTestServer(); do { AutoCSer.Net.TcpInternalServer.ServerAttribute attribute = AutoCSer.MemberCopy.Copyer <AutoCSer.Net.TcpInternalServer.ServerAttribute> .MemberwiseClone(serverAttribute); attribute.Port = 30000 + test.Version; AutoCSer.Example.TcpRegisterClient.RegisterClientTestServer.TcpInternalServer newServer = new RegisterClientTestServer.TcpInternalServer(attribute, null, test); if (newServer.IsListen) { if (server != null) { server.Dispose(); } server = newServer; Console.WriteLine(@" Version:" + test.Version.toString()); } else { Console.WriteLine(@" 测试服务启动失败"); } Thread.Sleep(5000); if (test.Version == 9) { Console.WriteLine(@" 测试结束"); isEnd = true; if (server != null) { server.Dispose(); } Console.ReadKey(); return; } test = new RegisterClientTestServer { Version = test.Version + 1 }; }while (true); } catch (Exception error) { Console.WriteLine(error.ToString()); } Console.ReadKey(); #if !DotNetStandard } } #endif }
/// <summary> /// 远程表达式测试 /// </summary> /// <returns></returns> internal static bool TestCase() { using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IRefOut> .Create(new RefOut())) { if (server.IsListen) { using (AutoCSer.Net.TcpInternalServer.Emit.MethodClient client = AutoCSer.Net.TcpInternalServer.Emit.Client <IRefOut> .Create() as AutoCSer.Net.TcpInternalServer.Emit.MethodClient) { if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField).Value.Value != 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty).Value.Value != 2) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3)).Value.Value != 3) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.Value).Value != 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.Value).Value != 2) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).Value).Value != 3) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4)[3]).Value != 4 + 3) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4).GetNextNode(2)).Value.Value != 4 + 2) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode).Value.Value != 1 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode).Value.Value != 2 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode).Value.Value != 3 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.Value).Value != 1 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.Value).Value != 2 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.Value).Value != 3 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4).NextNode[3]).Value != 4 + 1 - 3) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(4).NextNode.GetLastNode(2)).Value.Value != 4 + 1 - 2) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode).Value.Value != 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode).Value.Value != 2) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode).Value.Value != 3) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode.Value).Value != 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode.Value).Value != 2) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode.Value).Value != 3) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode.NextNode).Value.Value != 1 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode.NextNode).Value.Value != 2 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode.NextNode).Value.Value != 3 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticField.NextNode.LastNode.NextNode.Value).Value != 1 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticProperty.NextNode.LastNode.NextNode.Value).Value != 2 + 1) { return(false); } if (client._TcpClient_.GetRemoteExpression(RemoteExpression.StaticMethod(3).NextNode.LastNode.NextNode.Value).Value != 3 + 1) { return(false); } return(true); } } } return(false); }
static void Main(string[] args) { #if DotNetStandard Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle"); #else bool createdProcessWait; EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.TcpInternalServerPerformance.Emit", out createdProcessWait); if (createdProcessWait) { using (processWait) { #endif Console.WriteLine(@"http://www.AutoCSer.com/TcpServer/InterfaceServer.html "); using (AutoCSer.Net.TcpInternalServer.Server server = AutoCSer.Net.TcpInternalServer.Emit.Server <IServer> .Create(new InternalServer())) { if (server.IsListen) { #if DotNetStandard #if DEBUG FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\..\TcpClientPerformance\bin\Debug\netcoreapp2.0\AutoCSer.TestCase.TcpInternalClientPerformance.Emit.dll".pathSeparator())); #else FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\..\TcpClientPerformance\bin\Release\netcoreapp2.0\AutoCSer.TestCase.TcpInternalClientPerformance.Emit.dll".pathSeparator())); #endif if (!clientFile.Exists) { clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"AutoCSer.TestCase.TcpInternalClientPerformance.Emit.dll")); } if (clientFile.Exists) { ProcessStartInfo process = new ProcessStartInfo("dotnet", clientFile.FullName); process.UseShellExecute = true; Process.Start(process); } #else #if DEBUG FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\TcpClientPerformance\bin\Debug\AutoCSer.TestCase.TcpInternalClientPerformance.Emit.exe".pathSeparator())); #else FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\TcpClientPerformance\bin\Release\AutoCSer.TestCase.TcpInternalClientPerformance.Emit.exe".pathSeparator())); #endif if (!clientFile.Exists) { clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"AutoCSer.TestCase.TcpInternalClientPerformance.Emit.exe")); } if (clientFile.Exists) { Process.Start(clientFile.FullName); } #endif else { Console.WriteLine("未找到 TCP 内部服务性能测试服务 客户端程序"); } Console.WriteLine("Press quit to exit."); while (Console.ReadLine() != "quit") { ; } } else { Console.WriteLine("TCP 内部服务性能测试服务 启动失败"); Console.ReadKey(); } } #if !DotNetStandard } } #endif }
/// <summary> /// 设置TCP服务端 /// </summary> /// <param name="tcpServer">TCP服务端</param> public override void SetTcpServer(AutoCSer.Net.TcpInternalServer.Server tcpServer) { base.SetTcpServer(tcpServer); Cache = new CacheManager(Config, tcpServer); }
/// <summary> /// 设置TCP服务端 /// </summary> /// <param name="tcpServer">TCP服务端</param> public override void SetTcpServer(AutoCSer.Net.TcpInternalServer.Server tcpServer) { base.SetTcpServer(tcpServer); checkSocketVersion = Config.IsMasterCacheServer ? masterClient._TcpClient_.CreateCheckSocketVersion(onClientSocket) : slaveClient._TcpClient_.CreateCheckSocketVersion(onClientSocket); }