├── .gitattributes ├── .github └── workflows │ ├── build-linux.yml │ ├── build-macos.yml │ └── build-windows.yml ├── .gitignore ├── LICENSE ├── NetCoreServer.sln ├── README.md ├── TODO.md ├── _config.yml ├── build ├── VisualStudio │ ├── 01-build.bat │ ├── 02-tests.bat │ └── 03-release.bat ├── unix.sh └── vs.bat ├── examples ├── HttpClient │ ├── HttpClient.csproj │ └── Program.cs ├── HttpServer │ ├── HttpServer.csproj │ └── Program.cs ├── HttpsClient │ ├── HttpsClient.csproj │ └── Program.cs ├── HttpsServer │ ├── HttpsServer.csproj │ └── Program.cs ├── ProtoClient │ ├── Program.cs │ └── ProtoClient.csproj ├── ProtoServer │ ├── Program.cs │ └── ProtoServer.csproj ├── SslChatClient │ ├── Program.cs │ └── SslChatClient.csproj ├── SslChatServer │ ├── Program.cs │ └── SslChatServer.csproj ├── TcpChatClient │ ├── Program.cs │ └── TcpChatClient.csproj ├── TcpChatServer │ ├── Program.cs │ └── TcpChatServer.csproj ├── UdpEchoClient │ ├── Program.cs │ └── UdpEchoClient.csproj ├── UdpEchoServer │ ├── Program.cs │ └── UdpEchoServer.csproj ├── UdpMulticastClient │ ├── Program.cs │ └── UdpMulticastClient.csproj ├── UdpMulticastServer │ ├── Program.cs │ └── UdpMulticastServer.csproj ├── UdsChatClient │ ├── Program.cs │ └── UdsChatClient.csproj ├── UdsChatServer │ ├── Program.cs │ └── UdsChatServer.csproj ├── WsChatClient │ ├── Program.cs │ └── WsChatClient.csproj ├── WsChatServer │ ├── Program.cs │ └── WsChatServer.csproj ├── WssChatClient │ ├── Program.cs │ └── WssChatClient.csproj └── WssChatServer │ ├── Program.cs │ └── WssChatServer.csproj ├── images ├── multicast.ai ├── multicast.png ├── openapi-http.png ├── openapi-https.png ├── round-trip.ai ├── round-trip.png ├── ws-chat.png └── wss-chat.png ├── performance ├── HttpTraceClient │ ├── HttpTraceClient.csproj │ └── Program.cs ├── HttpTraceServer │ ├── HttpTraceServer.csproj │ └── Program.cs ├── HttpsTraceClient │ ├── HttpsTraceClient.csproj │ └── Program.cs ├── HttpsTraceServer │ ├── HttpsTraceServer.csproj │ └── Program.cs ├── ProtoClient │ ├── Program.cs │ └── ProtoClient.csproj ├── ProtoServer │ ├── Program.cs │ └── ProtoServer.csproj ├── SslEchoClient │ ├── Program.cs │ └── SslEchoClient.csproj ├── SslEchoServer │ ├── Program.cs │ └── SslEchoServer.csproj ├── SslMulticastClient │ ├── Program.cs │ └── SslMulticastClient.csproj ├── SslMulticastServer │ ├── Program.cs │ └── SslMulticastServer.csproj ├── TcpEchoClient │ ├── Program.cs │ └── TcpEchoClient.csproj ├── TcpEchoServer │ ├── Program.cs │ └── TcpEchoServer.csproj ├── TcpMulticastClient │ ├── Program.cs │ └── TcpMulticastClient.csproj ├── TcpMulticastServer │ ├── Program.cs │ └── TcpMulticastServer.csproj ├── UdpEchoClient │ ├── Program.cs │ └── UdpEchoClient.csproj ├── UdpEchoServer │ ├── Program.cs │ └── UdpEchoServer.csproj ├── UdpMulticastClient │ ├── Program.cs │ └── UdpMulticastClient.csproj ├── UdpMulticastServer │ ├── Program.cs │ └── UdpMulticastServer.csproj ├── UdsEchoClient │ ├── Program.cs │ └── UdsEchoClient.csproj ├── UdsEchoServer │ ├── Program.cs │ └── UdsEchoServer.csproj ├── UdsMulticastClient │ ├── Program.cs │ └── UdsMulticastClient.csproj ├── UdsMulticastServer │ ├── Program.cs │ └── UdsMulticastServer.csproj ├── WsEchoClient │ ├── Program.cs │ └── WsEchoClient.csproj ├── WsEchoServer │ ├── Program.cs │ └── WsEchoServer.csproj ├── WsMulticastClient │ ├── Program.cs │ └── WsMulticastClient.csproj ├── WsMulticastServer │ ├── Program.cs │ └── WsMulticastServer.csproj ├── WssEchoClient │ ├── Program.cs │ └── WssEchoClient.csproj ├── WssEchoServer │ ├── Program.cs │ └── WssEchoServer.csproj ├── WssMulticastClient │ ├── Program.cs │ └── WssMulticastClient.csproj └── WssMulticastServer │ ├── Program.cs │ └── WssMulticastServer.csproj ├── proto ├── com.chronoxor.fbe.cs ├── com.chronoxor.simple.cs ├── proto.csproj └── simple.fbe ├── source └── NetCoreServer │ ├── Buffer.cs │ ├── FileCache.cs │ ├── HttpClient.cs │ ├── HttpRequest.cs │ ├── HttpResponse.cs │ ├── HttpServer.cs │ ├── HttpSession.cs │ ├── HttpsClient.cs │ ├── HttpsServer.cs │ ├── HttpsSession.cs │ ├── IWebSocket.cs │ ├── NetCoreServer.csproj │ ├── SslClient.cs │ ├── SslContext.cs │ ├── SslServer.cs │ ├── SslSession.cs │ ├── StringExtensions.cs │ ├── TcpClient.cs │ ├── TcpServer.cs │ ├── TcpSession.cs │ ├── UdpClient.cs │ ├── UdpServer.cs │ ├── UdsClient.cs │ ├── UdsServer.cs │ ├── UdsSession.cs │ ├── Utilities.cs │ ├── WebSocket.cs │ ├── WsClient.cs │ ├── WsServer.cs │ ├── WsSession.cs │ ├── WssClient.cs │ ├── WssServer.cs │ └── WssSession.cs ├── tests ├── HttpTests.cs ├── HttpsTests.cs ├── ProtoTests.cs ├── SslTests.cs ├── TcpTests.cs ├── UdpMulticastTests.cs ├── UdpTests.cs ├── UdsTests.cs ├── WsTests.cs ├── WssTests.cs └── tests.csproj ├── tools └── certificates │ ├── ca-secret.key │ ├── ca.crt │ ├── ca.key │ ├── ca.pem │ ├── ca.pfx │ ├── client-secret.key │ ├── client.crt │ ├── client.csr │ ├── client.key │ ├── client.pem │ ├── client.pfx │ ├── dh4096.pem │ ├── generate.bat │ ├── generate.sh │ ├── server-secret.key │ ├── server.crt │ ├── server.csr │ ├── server.key │ ├── server.pem │ └── server.pfx └── www ├── api ├── index.html ├── openapi.yaml ├── swagger.js └── swagger │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── index.css │ ├── index.html │ ├── oauth2-redirect.html │ ├── swagger-initializer.js │ ├── swagger-ui-bundle.js │ ├── swagger-ui-bundle.js.map │ ├── swagger-ui-es-bundle-core.js │ ├── swagger-ui-es-bundle-core.js.map │ ├── swagger-ui-es-bundle.js │ ├── swagger-ui-es-bundle.js.map │ ├── swagger-ui-standalone-preset.js │ ├── swagger-ui-standalone-preset.js.map │ ├── swagger-ui.css │ ├── swagger-ui.css.map │ ├── swagger-ui.js │ └── swagger-ui.js.map ├── ws ├── favicon.png └── index.html └── wss ├── favicon.png └── index.html /.gitattributes: -------------------------------------------------------------------------------- 1 | build/* linguist-vendored 2 | images/* linguist-vendored 3 | packages/* linguist-vendored 4 | release/* linguist-vendored 5 | source/NetCoreServer/* linguist-vendored 6 | tools/* linguist-vendored 7 | www/* linguist-vendored 8 | -------------------------------------------------------------------------------- /.github/workflows/build-linux.yml: -------------------------------------------------------------------------------- 1 | name: Linux 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | 14 | - name: "Setup dotnet" 15 | uses: actions/setup-dotnet@v4 16 | with: 17 | dotnet-version: 8.x.x 18 | 19 | - name: "Build" 20 | run: | 21 | dotnet restore 22 | dotnet build --configuration Release 23 | # dotnet test 24 | -------------------------------------------------------------------------------- /.github/workflows/build-macos.yml: -------------------------------------------------------------------------------- 1 | name: MacOS 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: macos-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | 14 | - name: "Setup dotnet" 15 | uses: actions/setup-dotnet@v3 16 | with: 17 | dotnet-version: 8.x.x 18 | 19 | - name: "Build" 20 | run: | 21 | dotnet restore 22 | dotnet build --configuration Release 23 | # dotnet test 24 | -------------------------------------------------------------------------------- /.github/workflows/build-windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows 2 | 3 | on: 4 | push: 5 | pull_request: 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: windows-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | 14 | - name: "Setup dotnet" 15 | uses: actions/setup-dotnet@v3 16 | with: 17 | dotnet-version: 8.x.x 18 | 19 | - name: "Build" 20 | run: | 21 | dotnet restore 22 | dotnet build --configuration Release 23 | dotnet test 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2024 Ivan Shynkarenka 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # NetCoreServer todo 2 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman 2 | -------------------------------------------------------------------------------- /build/VisualStudio/01-build.bat: -------------------------------------------------------------------------------- 1 | cd ../.. 2 | nuget restore NetCoreServer.sln 3 | MSBuild NetCoreServer.sln /p:Configuration=Release /p:Platform="Any CPU" /t:pack 4 | if %errorlevel% neq 0 exit /b %errorlevel% 5 | cd build/VisualStudio 6 | -------------------------------------------------------------------------------- /build/VisualStudio/02-tests.bat: -------------------------------------------------------------------------------- 1 | cd ../.. 2 | dotnet test NetCoreServer.sln 3 | if %errorlevel% neq 0 exit /b %errorlevel% 4 | cd build/VisualStudio 5 | -------------------------------------------------------------------------------- /build/VisualStudio/03-release.bat: -------------------------------------------------------------------------------- 1 | mkdir ..\..\release 2 | cd ..\..\release 3 | 4 | mkdir NetCoreServer 5 | cd NetCoreServer 6 | xcopy /S /Y ..\..\source\NetCoreServer\bin\Release\*.* . 7 | 7z a ..\NetCoreServer.zip *.* 8 | cd .. 9 | rd /S /Q NetCoreServer 10 | 11 | mkdir examples 12 | cd examples 13 | xcopy /S /Y ..\..\examples\SslChatClient\bin\Release\*.* . 14 | xcopy /S /Y ..\..\examples\SslChatServer\bin\Release\*.* . 15 | xcopy /S /Y ..\..\examples\TcpChatClient\bin\Release\*.* . 16 | xcopy /S /Y ..\..\examples\TcpChatServer\bin\Release\*.* . 17 | xcopy /S /Y ..\..\examples\UdpEchoClient\bin\Release\*.* . 18 | xcopy /S /Y ..\..\examples\UdpEchoServer\bin\Release\*.* . 19 | xcopy /S /Y ..\..\examples\UdpMulticastClient\bin\Release\*.* . 20 | xcopy /S /Y ..\..\examples\UdpMulticastServer\bin\Release\*.* . 21 | xcopy /S /Y ..\..\tools\certificates\*.pem . 22 | 7z a ..\Examples.zip *.* 23 | cd .. 24 | rd /S /Q examples 25 | 26 | mkdir performance 27 | cd performance 28 | xcopy /S /Y ..\..\performance\SslEchoClient\bin\Release\*.* . 29 | xcopy /S /Y ..\..\performance\SslEchoServer\bin\Release\*.* . 30 | xcopy /S /Y ..\..\performance\SslMulticastClient\bin\Release\*.* . 31 | xcopy /S /Y ..\..\performance\SslMulticastServer\bin\Release\*.* . 32 | xcopy /S /Y ..\..\performance\TcpEchoClient\bin\Release\*.* . 33 | xcopy /S /Y ..\..\performance\TcpEchoServer\bin\Release\*.* . 34 | xcopy /S /Y ..\..\performance\TcpMulticastClient\bin\Release\*.* . 35 | xcopy /S /Y ..\..\performance\TcpMulticastServer\bin\Release\*.* . 36 | xcopy /S /Y ..\..\performance\UdpEchoClient\bin\Release\*.* . 37 | xcopy /S /Y ..\..\performance\UdpEchoServer\bin\Release\*.* . 38 | xcopy /S /Y ..\..\performance\UdpMulticastClient\bin\Release\*.* . 39 | xcopy /S /Y ..\..\performance\UdpMulticastServer\bin\Release\*.* . 40 | xcopy /S /Y ..\..\tools\certificates\*.pem . 41 | 7z a ..\Benchmarks.zip *.* 42 | cd .. 43 | rd /S /Q performance 44 | 45 | cd ../build/VisualStudio 46 | -------------------------------------------------------------------------------- /build/unix.sh: -------------------------------------------------------------------------------- 1 | cd .. 2 | dotnet restore 3 | dotnet build 4 | dotnet test 5 | cd build 6 | -------------------------------------------------------------------------------- /build/vs.bat: -------------------------------------------------------------------------------- 1 | cd VisualStudio 2 | call 01-build.bat 3 | if %errorlevel% neq 0 exit /b %errorlevel% 4 | call 02-tests.bat 5 | if %errorlevel% neq 0 exit /b %errorlevel% 6 | call 03-release.bat 7 | if %errorlevel% neq 0 exit /b %errorlevel% 8 | -------------------------------------------------------------------------------- /examples/HttpClient/HttpClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/HttpClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Net; 4 | using NetCoreServer; 5 | 6 | namespace HttpClient 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | // HTTP server address 13 | string address = "localhost"; 14 | if (args.Length > 0) 15 | address = args[0]; 16 | 17 | // HTTP server port 18 | int port = 8080; 19 | if (args.Length > 1) 20 | port = int.Parse(args[1]); 21 | 22 | Console.WriteLine($"HTTP server address: {address}"); 23 | Console.WriteLine($"HTTP server port: {port}"); 24 | 25 | Console.WriteLine(); 26 | 27 | // Create a new HTTP client 28 | var client = new HttpClientEx(Dns.GetHostAddresses(address).FirstOrDefault(), port); 29 | 30 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 31 | 32 | // Perform text input 33 | for (;;) 34 | { 35 | string line = Console.ReadLine(); 36 | if (string.IsNullOrEmpty(line)) 37 | break; 38 | 39 | // Reconnect the client 40 | if (line == "!") 41 | { 42 | Console.Write("Client reconnecting..."); 43 | if (client.IsConnected) 44 | client.ReconnectAsync(); 45 | else 46 | client.ConnectAsync(); 47 | Console.WriteLine("Done!"); 48 | continue; 49 | } 50 | 51 | var commands = line.Split(' '); 52 | if (commands.Length < 2) 53 | { 54 | Console.WriteLine("HTTP method and URL must be entered!"); 55 | continue; 56 | } 57 | 58 | if (commands[0].ToUpper() == "HEAD") 59 | { 60 | var response = client.SendHeadRequest(commands[1]).Result; 61 | Console.WriteLine(response); 62 | } 63 | else if (commands[0].ToUpper() == "GET") 64 | { 65 | var response = client.SendGetRequest(commands[1]).Result; 66 | Console.WriteLine(response); 67 | } 68 | else if (commands[0].ToUpper() == "POST") 69 | { 70 | if (commands.Length < 3) 71 | { 72 | Console.WriteLine("HTTP method, URL and body must be entered!"); 73 | continue; 74 | } 75 | 76 | var response = client.SendPostRequest(commands[1], commands[2]).Result; 77 | Console.WriteLine(response); 78 | } 79 | else if (commands[0].ToUpper() == "PUT") 80 | { 81 | if (commands.Length < 3) 82 | { 83 | Console.WriteLine("HTTP method, URL and body must be entered!"); 84 | continue; 85 | } 86 | 87 | var response = client.SendPutRequest(commands[1], commands[2]).Result; 88 | Console.WriteLine(response); 89 | } 90 | else if (commands[0].ToUpper() == "DELETE") 91 | { 92 | var response = client.SendDeleteRequest(commands[1]).Result; 93 | Console.WriteLine(response); 94 | } 95 | else if (commands[0].ToUpper() == "OPTIONS") 96 | { 97 | var response = client.SendOptionsRequest(commands[1]).Result; 98 | Console.WriteLine(response); 99 | } 100 | else if (commands[0].ToUpper() == "TRACE") 101 | { 102 | var response = client.SendTraceRequest(commands[1]).Result; 103 | Console.WriteLine(response); 104 | } 105 | else 106 | Console.WriteLine("Unknown HTTP method"); 107 | } 108 | 109 | // Disconnect the client 110 | Console.Write("Client disconnecting..."); 111 | client.Disconnect(); 112 | Console.WriteLine("Done!"); 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /examples/HttpServer/HttpServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/HttpsClient/HttpsClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/HttpsClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Net; 4 | using System.Security.Authentication; 5 | using System.Security.Cryptography.X509Certificates; 6 | using NetCoreServer; 7 | 8 | namespace HttpsClient 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | // HTTPS server address 15 | string address = "localhost"; 16 | if (args.Length > 0) 17 | address = args[0]; 18 | 19 | // HTTPS server port 20 | int port = 8443; 21 | if (args.Length > 1) 22 | port = int.Parse(args[1]); 23 | 24 | Console.WriteLine($"HTTPS server address: {address}"); 25 | Console.WriteLine($"HTTPS server port: {port}"); 26 | 27 | Console.WriteLine(); 28 | 29 | // Create and prepare a new SSL client context 30 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("client.pfx", "qwerty"), (sender, certificate, chain, sslPolicyErrors) => true); 31 | 32 | // Create a new HTTPS client 33 | var client = new HttpsClientEx(context, Dns.GetHostAddresses(address).FirstOrDefault(), port); 34 | 35 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 36 | 37 | // Perform text input 38 | for (;;) 39 | { 40 | string line = Console.ReadLine(); 41 | if (string.IsNullOrEmpty(line)) 42 | break; 43 | 44 | // Reconnect the client 45 | if (line == "!") 46 | { 47 | Console.Write("Client reconnecting..."); 48 | if (client.IsConnected) 49 | client.ReconnectAsync(); 50 | else 51 | client.ConnectAsync(); 52 | Console.WriteLine("Done!"); 53 | continue; 54 | } 55 | 56 | var commands = line.Split(' '); 57 | if (commands.Length < 2) 58 | { 59 | Console.WriteLine("HTTP method and URL must be entered!"); 60 | continue; 61 | } 62 | 63 | if (commands[0].ToUpper() == "HEAD") 64 | { 65 | var response = client.SendHeadRequest(commands[1]).Result; 66 | Console.WriteLine(response); 67 | } 68 | else if (commands[0].ToUpper() == "GET") 69 | { 70 | var response = client.SendGetRequest(commands[1]).Result; 71 | Console.WriteLine(response); 72 | } 73 | else if (commands[0].ToUpper() == "POST") 74 | { 75 | if (commands.Length < 3) 76 | { 77 | Console.WriteLine("HTTP method, URL and body must be entered!"); 78 | continue; 79 | } 80 | 81 | var response = client.SendPostRequest(commands[1], commands[2]).Result; 82 | Console.WriteLine(response); 83 | } 84 | else if (commands[0].ToUpper() == "PUT") 85 | { 86 | if (commands.Length < 3) 87 | { 88 | Console.WriteLine("HTTP method, URL and body must be entered!"); 89 | continue; 90 | } 91 | 92 | var response = client.SendPutRequest(commands[1], commands[2]).Result; 93 | Console.WriteLine(response); 94 | } 95 | else if (commands[0].ToUpper() == "DELETE") 96 | { 97 | var response = client.SendDeleteRequest(commands[1]).Result; 98 | Console.WriteLine(response); 99 | } 100 | else if (commands[0].ToUpper() == "OPTIONS") 101 | { 102 | var response = client.SendOptionsRequest(commands[1]).Result; 103 | Console.WriteLine(response); 104 | } 105 | else if (commands[0].ToUpper() == "TRACE") 106 | { 107 | var response = client.SendTraceRequest(commands[1]).Result; 108 | Console.WriteLine(response); 109 | } 110 | else 111 | Console.WriteLine("Unknown HTTP method"); 112 | } 113 | 114 | // Disconnect the client 115 | Console.Write("Client disconnecting..."); 116 | client.Disconnect(); 117 | Console.WriteLine("Done!"); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /examples/HttpsServer/HttpsServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/ProtoClient/ProtoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/ProtoServer/ProtoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /examples/SslChatClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Sockets; 3 | using System.Security.Authentication; 4 | using System.Security.Cryptography.X509Certificates; 5 | using System.Text; 6 | using System.Threading; 7 | using NetCoreServer; 8 | 9 | namespace SslChatClient 10 | { 11 | class ChatClient : SslClient 12 | { 13 | public ChatClient(SslContext context, string address, int port) : base(context, address, port) {} 14 | 15 | public void DisconnectAndStop() 16 | { 17 | _stop = true; 18 | DisconnectAsync(); 19 | while (IsConnected) 20 | Thread.Yield(); 21 | } 22 | 23 | protected override void OnConnected() 24 | { 25 | Console.WriteLine($"Chat SSL client connected a new session with Id {Id}"); 26 | } 27 | 28 | protected override void OnHandshaked() 29 | { 30 | Console.WriteLine($"Chat SSL client handshaked a new session with Id {Id}"); 31 | } 32 | 33 | protected override void OnDisconnected() 34 | { 35 | Console.WriteLine($"Chat SSL client disconnected a session with Id {Id}"); 36 | 37 | // Wait for a while... 38 | Thread.Sleep(1000); 39 | 40 | // Try to connect again 41 | if (!_stop) 42 | ConnectAsync(); 43 | } 44 | 45 | protected override void OnReceived(byte[] buffer, long offset, long size) 46 | { 47 | Console.WriteLine(Encoding.UTF8.GetString(buffer, (int)offset, (int)size)); 48 | } 49 | 50 | protected override void OnError(SocketError error) 51 | { 52 | Console.WriteLine($"Chat SSL client caught an error with code {error}"); 53 | } 54 | 55 | private bool _stop; 56 | } 57 | 58 | class Program 59 | { 60 | static void Main(string[] args) 61 | { 62 | // SSL server address 63 | string address = "127.0.0.1"; 64 | if (args.Length > 0) 65 | address = args[0]; 66 | 67 | // SSL server port 68 | int port = 2222; 69 | if (args.Length > 1) 70 | port = int.Parse(args[1]); 71 | 72 | Console.WriteLine($"SSL server address: {address}"); 73 | Console.WriteLine($"SSL server port: {port}"); 74 | 75 | Console.WriteLine(); 76 | 77 | // Create and prepare a new SSL client context 78 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("client.pfx", "qwerty"), (sender, certificate, chain, sslPolicyErrors) => true); 79 | 80 | // Create a new SSL chat client 81 | var client = new ChatClient(context, address, port); 82 | 83 | // Connect the client 84 | Console.Write("Client connecting..."); 85 | client.ConnectAsync(); 86 | Console.WriteLine("Done!"); 87 | 88 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 89 | 90 | // Perform text input 91 | for (;;) 92 | { 93 | string line = Console.ReadLine(); 94 | if (string.IsNullOrEmpty(line)) 95 | break; 96 | 97 | // Disconnect the client 98 | if (line == "!") 99 | { 100 | Console.Write("Client disconnecting..."); 101 | client.DisconnectAsync(); 102 | Console.WriteLine("Done!"); 103 | continue; 104 | } 105 | 106 | // Send the entered text to the chat server 107 | client.SendAsync(line); 108 | } 109 | 110 | // Disconnect the client 111 | Console.Write("Client disconnecting..."); 112 | client.DisconnectAndStop(); 113 | Console.WriteLine("Done!"); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /examples/SslChatClient/SslChatClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/SslChatServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Security.Authentication; 5 | using System.Security.Cryptography.X509Certificates; 6 | using System.Text; 7 | using NetCoreServer; 8 | 9 | namespace SslChatServer 10 | { 11 | class ChatSession : SslSession 12 | { 13 | public ChatSession(SslServer server) : base(server) {} 14 | 15 | protected override void OnConnected() 16 | { 17 | Console.WriteLine($"Chat SSL session with Id {Id} connected!"); 18 | } 19 | 20 | protected override void OnHandshaked() 21 | { 22 | Console.WriteLine($"Chat SSL session with Id {Id} handshaked!"); 23 | 24 | // Send invite message 25 | string message = "Hello from SSL chat! Please send a message or '!' to disconnect the client!"; 26 | Send(message); 27 | } 28 | 29 | protected override void OnDisconnected() 30 | { 31 | Console.WriteLine($"Chat SSL session with Id {Id} disconnected!"); 32 | } 33 | 34 | protected override void OnReceived(byte[] buffer, long offset, long size) 35 | { 36 | string message = Encoding.UTF8.GetString(buffer, (int)offset, (int)size); 37 | Console.WriteLine("Incoming: " + message); 38 | 39 | // Multicast message to all connected sessions 40 | Server.Multicast(message); 41 | 42 | // If the buffer starts with '!' the disconnect the current session 43 | if (message == "!") 44 | Disconnect(); 45 | } 46 | 47 | protected override void OnError(SocketError error) 48 | { 49 | Console.WriteLine($"Chat SSL session caught an error with code {error}"); 50 | } 51 | } 52 | 53 | class ChatServer : SslServer 54 | { 55 | public ChatServer(SslContext context, IPAddress address, int port) : base(context, address, port) {} 56 | 57 | protected override SslSession CreateSession() { return new ChatSession(this); } 58 | 59 | protected override void OnError(SocketError error) 60 | { 61 | Console.WriteLine($"Chat SSL server caught an error with code {error}"); 62 | } 63 | } 64 | 65 | class Program 66 | { 67 | static void Main(string[] args) 68 | { 69 | // SSL server port 70 | int port = 2222; 71 | if (args.Length > 0) 72 | port = int.Parse(args[0]); 73 | 74 | Console.WriteLine($"SSL server port: {port}"); 75 | 76 | Console.WriteLine(); 77 | 78 | // Create and prepare a new SSL server context 79 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("server.pfx", "qwerty")); 80 | 81 | // Create a new SSL chat server 82 | var server = new ChatServer(context, IPAddress.Any, port); 83 | 84 | // Start the server 85 | Console.Write("Server starting..."); 86 | server.Start(); 87 | Console.WriteLine("Done!"); 88 | 89 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 90 | 91 | // Perform text input 92 | for (;;) 93 | { 94 | string line = Console.ReadLine(); 95 | if (string.IsNullOrEmpty(line)) 96 | break; 97 | 98 | // Restart the server 99 | if (line == "!") 100 | { 101 | Console.Write("Server restarting..."); 102 | server.Restart(); 103 | Console.WriteLine("Done!"); 104 | continue; 105 | } 106 | 107 | // Multicast admin message to all sessions 108 | line = "(admin) " + line; 109 | server.Multicast(line); 110 | } 111 | 112 | // Stop the server 113 | Console.Write("Server stopping..."); 114 | server.Stop(); 115 | Console.WriteLine("Done!"); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /examples/SslChatServer/SslChatServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/TcpChatClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Sockets; 3 | using System.Text; 4 | using System.Threading; 5 | using TcpClient = NetCoreServer.TcpClient; 6 | 7 | namespace TcpChatClient 8 | { 9 | class ChatClient : TcpClient 10 | { 11 | public ChatClient(string address, int port) : base(address, port) {} 12 | 13 | public void DisconnectAndStop() 14 | { 15 | _stop = true; 16 | DisconnectAsync(); 17 | while (IsConnected) 18 | Thread.Yield(); 19 | } 20 | 21 | protected override void OnConnected() 22 | { 23 | Console.WriteLine($"Chat TCP client connected a new session with Id {Id}"); 24 | } 25 | 26 | protected override void OnDisconnected() 27 | { 28 | Console.WriteLine($"Chat TCP client disconnected a session with Id {Id}"); 29 | 30 | // Wait for a while... 31 | Thread.Sleep(1000); 32 | 33 | // Try to connect again 34 | if (!_stop) 35 | ConnectAsync(); 36 | } 37 | 38 | protected override void OnReceived(byte[] buffer, long offset, long size) 39 | { 40 | Console.WriteLine(Encoding.UTF8.GetString(buffer, (int)offset, (int)size)); 41 | } 42 | 43 | protected override void OnError(SocketError error) 44 | { 45 | Console.WriteLine($"Chat TCP client caught an error with code {error}"); 46 | } 47 | 48 | private bool _stop; 49 | } 50 | 51 | class Program 52 | { 53 | static void Main(string[] args) 54 | { 55 | // TCP server address 56 | string address = "127.0.0.1"; 57 | if (args.Length > 0) 58 | address = args[0]; 59 | 60 | // TCP server port 61 | int port = 1111; 62 | if (args.Length > 1) 63 | port = int.Parse(args[1]); 64 | 65 | Console.WriteLine($"TCP server address: {address}"); 66 | Console.WriteLine($"TCP server port: {port}"); 67 | 68 | Console.WriteLine(); 69 | 70 | // Create a new TCP chat client 71 | var client = new ChatClient(address, port); 72 | 73 | // Connect the client 74 | Console.Write("Client connecting..."); 75 | client.ConnectAsync(); 76 | Console.WriteLine("Done!"); 77 | 78 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 79 | 80 | // Perform text input 81 | for (;;) 82 | { 83 | string line = Console.ReadLine(); 84 | if (string.IsNullOrEmpty(line)) 85 | break; 86 | 87 | // Disconnect the client 88 | if (line == "!") 89 | { 90 | Console.Write("Client disconnecting..."); 91 | client.DisconnectAsync(); 92 | Console.WriteLine("Done!"); 93 | continue; 94 | } 95 | 96 | // Send the entered text to the chat server 97 | client.SendAsync(line); 98 | } 99 | 100 | // Disconnect the client 101 | Console.Write("Client disconnecting..."); 102 | client.DisconnectAndStop(); 103 | Console.WriteLine("Done!"); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /examples/TcpChatClient/TcpChatClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/TcpChatServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using NetCoreServer; 6 | 7 | namespace TcpChatServer 8 | { 9 | class ChatSession : TcpSession 10 | { 11 | public ChatSession(TcpServer server) : base(server) {} 12 | 13 | protected override void OnConnected() 14 | { 15 | Console.WriteLine($"Chat TCP session with Id {Id} connected!"); 16 | 17 | // Send invite message 18 | string message = "Hello from TCP chat! Please send a message or '!' to disconnect the client!"; 19 | SendAsync(message); 20 | } 21 | 22 | protected override void OnDisconnected() 23 | { 24 | Console.WriteLine($"Chat TCP session with Id {Id} disconnected!"); 25 | } 26 | 27 | protected override void OnReceived(byte[] buffer, long offset, long size) 28 | { 29 | string message = Encoding.UTF8.GetString(buffer, (int)offset, (int)size); 30 | Console.WriteLine("Incoming: " + message); 31 | 32 | // Multicast message to all connected sessions 33 | Server.Multicast(message); 34 | 35 | // If the buffer starts with '!' the disconnect the current session 36 | if (message == "!") 37 | Disconnect(); 38 | } 39 | 40 | protected override void OnError(SocketError error) 41 | { 42 | Console.WriteLine($"Chat TCP session caught an error with code {error}"); 43 | } 44 | } 45 | 46 | class ChatServer : TcpServer 47 | { 48 | public ChatServer(IPAddress address, int port) : base(address, port) {} 49 | 50 | protected override TcpSession CreateSession() { return new ChatSession(this); } 51 | 52 | protected override void OnError(SocketError error) 53 | { 54 | Console.WriteLine($"Chat TCP server caught an error with code {error}"); 55 | } 56 | } 57 | 58 | class Program 59 | { 60 | static void Main(string[] args) 61 | { 62 | // TCP server port 63 | int port = 1111; 64 | if (args.Length > 0) 65 | port = int.Parse(args[0]); 66 | 67 | Console.WriteLine($"TCP server port: {port}"); 68 | 69 | Console.WriteLine(); 70 | 71 | // Create a new TCP chat server 72 | var server = new ChatServer(IPAddress.Any, port); 73 | 74 | // Start the server 75 | Console.Write("Server starting..."); 76 | server.Start(); 77 | Console.WriteLine("Done!"); 78 | 79 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 80 | 81 | // Perform text input 82 | for (;;) 83 | { 84 | string line = Console.ReadLine(); 85 | if (string.IsNullOrEmpty(line)) 86 | break; 87 | 88 | // Restart the server 89 | if (line == "!") 90 | { 91 | Console.Write("Server restarting..."); 92 | server.Restart(); 93 | Console.WriteLine("Done!"); 94 | continue; 95 | } 96 | 97 | // Multicast admin message to all sessions 98 | line = "(admin) " + line; 99 | server.Multicast(line); 100 | } 101 | 102 | // Stop the server 103 | Console.Write("Server stopping..."); 104 | server.Stop(); 105 | Console.WriteLine("Done!"); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /examples/TcpChatServer/TcpChatServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/UdpEchoClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using System.Threading; 6 | using UdpClient = NetCoreServer.UdpClient; 7 | 8 | namespace UdpEchoClient 9 | { 10 | class EchoClient : UdpClient 11 | { 12 | public EchoClient(string address, int port) : base(address, port) {} 13 | 14 | public void DisconnectAndStop() 15 | { 16 | _stop = true; 17 | Disconnect(); 18 | while (IsConnected) 19 | Thread.Yield(); 20 | } 21 | 22 | protected override void OnConnected() 23 | { 24 | Console.WriteLine($"Echo UDP client connected a new session with Id {Id}"); 25 | 26 | // Start receive datagrams 27 | ReceiveAsync(); 28 | } 29 | 30 | protected override void OnDisconnected() 31 | { 32 | Console.WriteLine($"Echo UDP client disconnected a session with Id {Id}"); 33 | 34 | // Wait for a while... 35 | Thread.Sleep(1000); 36 | 37 | // Try to connect again 38 | if (!_stop) 39 | Connect(); 40 | } 41 | 42 | protected override void OnReceived(EndPoint endpoint, byte[] buffer, long offset, long size) 43 | { 44 | Console.WriteLine("Incoming: " + Encoding.UTF8.GetString(buffer, (int)offset, (int)size)); 45 | 46 | // Continue receive datagrams 47 | ReceiveAsync(); 48 | } 49 | 50 | protected override void OnError(SocketError error) 51 | { 52 | Console.WriteLine($"Echo UDP client caught an error with code {error}"); 53 | } 54 | 55 | private bool _stop; 56 | } 57 | 58 | class Program 59 | { 60 | static void Main(string[] args) 61 | { 62 | // UDP server address 63 | string address = "127.0.0.1"; 64 | if (args.Length > 0) 65 | address = args[0]; 66 | 67 | // UDP server port 68 | int port = 3333; 69 | if (args.Length > 1) 70 | port = int.Parse(args[1]); 71 | 72 | Console.WriteLine($"UDP server address: {address}"); 73 | Console.WriteLine($"UDP server port: {port}"); 74 | 75 | Console.WriteLine(); 76 | 77 | // Create a new TCP chat client 78 | var client = new EchoClient(address, port); 79 | 80 | // Connect the client 81 | Console.Write("Client connecting..."); 82 | client.Connect(); 83 | Console.WriteLine("Done!"); 84 | 85 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 86 | 87 | // Perform text input 88 | for (;;) 89 | { 90 | string line = Console.ReadLine(); 91 | if (string.IsNullOrEmpty(line)) 92 | break; 93 | 94 | // Disconnect the client 95 | if (line == "!") 96 | { 97 | Console.Write("Client disconnecting..."); 98 | client.Disconnect(); 99 | Console.WriteLine("Done!"); 100 | continue; 101 | } 102 | 103 | // Send the entered text to the chat server 104 | client.Send(line); 105 | } 106 | 107 | // Disconnect the client 108 | Console.Write("Client disconnecting..."); 109 | client.DisconnectAndStop(); 110 | Console.WriteLine("Done!"); 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /examples/UdpEchoClient/UdpEchoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/UdpEchoServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using NetCoreServer; 6 | 7 | namespace UdpEchoServer 8 | { 9 | class EchoServer : UdpServer 10 | { 11 | public EchoServer(IPAddress address, int port) : base(address, port) {} 12 | 13 | protected override void OnStarted() 14 | { 15 | // Start receive datagrams 16 | ReceiveAsync(); 17 | } 18 | 19 | protected override void OnReceived(EndPoint endpoint, byte[] buffer, long offset, long size) 20 | { 21 | Console.WriteLine("Incoming: " + Encoding.UTF8.GetString(buffer, (int)offset, (int)size)); 22 | 23 | // Echo the message back to the sender 24 | SendAsync(endpoint, buffer, 0, size); 25 | } 26 | 27 | protected override void OnSent(EndPoint endpoint, long sent) 28 | { 29 | // Continue receive datagrams 30 | ReceiveAsync(); 31 | } 32 | 33 | protected override void OnError(SocketError error) 34 | { 35 | Console.WriteLine($"Echo UDP server caught an error with code {error}"); 36 | } 37 | } 38 | 39 | class Program 40 | { 41 | static void Main(string[] args) 42 | { 43 | // UDP server port 44 | int port = 3333; 45 | if (args.Length > 0) 46 | port = int.Parse(args[0]); 47 | 48 | Console.WriteLine($"UDP server port: {port}"); 49 | 50 | Console.WriteLine(); 51 | 52 | // Create a new UDP echo server 53 | var server = new EchoServer(IPAddress.Any, port); 54 | 55 | // Start the server 56 | Console.Write("Server starting..."); 57 | server.Start(); 58 | Console.WriteLine("Done!"); 59 | 60 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 61 | 62 | // Perform text input 63 | for (;;) 64 | { 65 | string line = Console.ReadLine(); 66 | if (string.IsNullOrEmpty(line)) 67 | break; 68 | 69 | // Restart the server 70 | if (line == "!") 71 | { 72 | Console.Write("Server restarting..."); 73 | server.Restart(); 74 | Console.WriteLine("Done!"); 75 | } 76 | } 77 | 78 | // Stop the server 79 | Console.Write("Server stopping..."); 80 | server.Stop(); 81 | Console.WriteLine("Done!"); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /examples/UdpEchoServer/UdpEchoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/UdpMulticastClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using System.Threading; 6 | using UdpClient = NetCoreServer.UdpClient; 7 | 8 | namespace UdpMulticastClient 9 | { 10 | class MulticastClient : UdpClient 11 | { 12 | public string Multicast; 13 | 14 | public MulticastClient(string address, int port) : base(address, port) {} 15 | 16 | public void DisconnectAndStop() 17 | { 18 | _stop = true; 19 | Disconnect(); 20 | while (IsConnected) 21 | Thread.Yield(); 22 | } 23 | 24 | protected override void OnConnected() 25 | { 26 | Console.WriteLine($"Multicast UDP client connected a new session with Id {Id}"); 27 | 28 | // Join UDP multicast group 29 | JoinMulticastGroup(Multicast); 30 | 31 | // Start receive datagrams 32 | ReceiveAsync(); 33 | } 34 | 35 | protected override void OnDisconnected() 36 | { 37 | Console.WriteLine($"Multicast UDP client disconnected a session with Id {Id}"); 38 | 39 | // Wait for a while... 40 | Thread.Sleep(1000); 41 | 42 | // Try to connect again 43 | if (!_stop) 44 | Connect(); 45 | } 46 | 47 | protected override void OnReceived(EndPoint endpoint, byte[] buffer, long offset, long size) 48 | { 49 | Console.WriteLine("Incoming: " + Encoding.UTF8.GetString(buffer, (int)offset, (int)size)); 50 | 51 | // Continue receive datagrams 52 | ReceiveAsync(); 53 | } 54 | 55 | protected override void OnError(SocketError error) 56 | { 57 | Console.WriteLine($"Multicast UDP client caught an error with code {error}"); 58 | } 59 | 60 | private bool _stop; 61 | } 62 | 63 | class Program 64 | { 65 | static void Main(string[] args) 66 | { 67 | // UDP listen address 68 | string listenAddress = "0.0.0.0"; 69 | if (args.Length > 0) 70 | listenAddress = args[0]; 71 | 72 | // UDP multicast address 73 | string multicastAddress = "239.255.0.1"; 74 | if (args.Length > 1) 75 | multicastAddress = args[1]; 76 | 77 | // UDP multicast port 78 | int multicastPort = 3334; 79 | if (args.Length > 2) 80 | multicastPort = int.Parse(args[2]); 81 | 82 | Console.WriteLine($"UDP listen address: {listenAddress}"); 83 | Console.WriteLine($"UDP multicast address: {multicastAddress}"); 84 | Console.WriteLine($"UDP multicast port: {multicastPort}"); 85 | 86 | Console.WriteLine(); 87 | 88 | // Create a new TCP chat client 89 | var client = new MulticastClient(listenAddress, multicastPort); 90 | client.SetupMulticast(true); 91 | client.Multicast = multicastAddress; 92 | 93 | // Connect the client 94 | Console.Write("Client connecting..."); 95 | client.Connect(); 96 | Console.WriteLine("Done!"); 97 | 98 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 99 | 100 | // Perform text input 101 | for (;;) 102 | { 103 | string line = Console.ReadLine(); 104 | if (string.IsNullOrEmpty(line)) 105 | break; 106 | 107 | // Disconnect the client 108 | if (line == "!") 109 | { 110 | Console.Write("Client disconnecting..."); 111 | client.Disconnect(); 112 | Console.WriteLine("Done!"); 113 | continue; 114 | } 115 | } 116 | 117 | // Disconnect the client 118 | Console.Write("Client disconnecting..."); 119 | client.DisconnectAndStop(); 120 | Console.WriteLine("Done!"); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /examples/UdpMulticastClient/UdpMulticastClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/UdpMulticastServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using NetCoreServer; 5 | 6 | namespace UdpMulticastServer 7 | { 8 | class MulticastServer : UdpServer 9 | { 10 | public MulticastServer(IPAddress address, int port) : base(address, port) {} 11 | 12 | protected override void OnError(SocketError error) 13 | { 14 | Console.WriteLine($"Multicast UDP server caught an error with code {error}"); 15 | } 16 | } 17 | 18 | class Program 19 | { 20 | static void Main(string[] args) 21 | { 22 | // UDP multicast address 23 | string multicastAddress = "239.255.0.1"; 24 | if (args.Length > 0) 25 | multicastAddress = args[0]; 26 | 27 | // UDP multicast port 28 | int multicastPort = 3334; 29 | if (args.Length > 1) 30 | multicastPort = int.Parse(args[1]); 31 | 32 | Console.WriteLine($"UDP multicast address: {multicastAddress}"); 33 | Console.WriteLine($"UDP multicast port: {multicastPort}"); 34 | 35 | Console.WriteLine(); 36 | 37 | // Create a new UDP multicast server 38 | var server = new MulticastServer(IPAddress.Any, 0); 39 | 40 | // Start the multicast server 41 | Console.Write("Server starting..."); 42 | server.Start(multicastAddress, multicastPort); 43 | Console.WriteLine("Done!"); 44 | 45 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 46 | 47 | // Perform text input 48 | for (;;) 49 | { 50 | string line = Console.ReadLine(); 51 | if (string.IsNullOrEmpty(line)) 52 | break; 53 | 54 | // Restart the server 55 | if (line == "!") 56 | { 57 | Console.Write("Server restarting..."); 58 | server.Restart(); 59 | Console.WriteLine("Done!"); 60 | continue; 61 | } 62 | 63 | // Multicast admin message to all sessions 64 | line = "(admin) " + line; 65 | server.Multicast(line); 66 | } 67 | 68 | // Stop the server 69 | Console.Write("Server stopping..."); 70 | server.Stop(); 71 | Console.WriteLine("Done!"); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /examples/UdpMulticastServer/UdpMulticastServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/UdsChatClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using System.Threading; 6 | using NetCoreServer; 7 | 8 | namespace UdsChatClient 9 | { 10 | class ChatClient : UdsClient 11 | { 12 | public ChatClient(string path) : base(path) {} 13 | 14 | public void DisconnectAndStop() 15 | { 16 | _stop = true; 17 | DisconnectAsync(); 18 | while (IsConnected) 19 | Thread.Yield(); 20 | } 21 | 22 | protected override void OnConnected() 23 | { 24 | Console.WriteLine($"Chat Unix Domain Socket client connected a new session with Id {Id}"); 25 | } 26 | 27 | protected override void OnDisconnected() 28 | { 29 | Console.WriteLine($"Chat Unix Domain Socket client disconnected a session with Id {Id}"); 30 | 31 | // Wait for a while... 32 | Thread.Sleep(1000); 33 | 34 | // Try to connect again 35 | if (!_stop) 36 | ConnectAsync(); 37 | } 38 | 39 | protected override void OnReceived(byte[] buffer, long offset, long size) 40 | { 41 | Console.WriteLine(Encoding.UTF8.GetString(buffer, (int)offset, (int)size)); 42 | } 43 | 44 | protected override void OnError(SocketError error) 45 | { 46 | Console.WriteLine($"Chat Unix Domain Socket client caught an error with code {error}"); 47 | } 48 | 49 | private bool _stop; 50 | } 51 | 52 | class Program 53 | { 54 | static void Main(string[] args) 55 | { 56 | // Unix Domain Socket path 57 | string path = Path.Combine(Path.GetTempPath(), "chat.sock"); 58 | if (args.Length > 0) 59 | path = args[0]; 60 | 61 | Console.WriteLine($"Unix Domain Socket server path: {path}"); 62 | 63 | Console.WriteLine(); 64 | 65 | // Create a new Unix Domain Socket chat client 66 | var client = new ChatClient(path); 67 | 68 | // Connect the client 69 | Console.Write("Client connecting..."); 70 | client.ConnectAsync(); 71 | Console.WriteLine("Done!"); 72 | 73 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 74 | 75 | // Perform text input 76 | for (;;) 77 | { 78 | string line = Console.ReadLine(); 79 | if (string.IsNullOrEmpty(line)) 80 | break; 81 | 82 | // Disconnect the client 83 | if (line == "!") 84 | { 85 | Console.Write("Client disconnecting..."); 86 | client.DisconnectAsync(); 87 | Console.WriteLine("Done!"); 88 | continue; 89 | } 90 | 91 | // Send the entered text to the chat server 92 | client.SendAsync(line); 93 | } 94 | 95 | // Disconnect the client 96 | Console.Write("Client disconnecting..."); 97 | client.DisconnectAndStop(); 98 | Console.WriteLine("Done!"); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /examples/UdsChatClient/UdsChatClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/UdsChatServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using NetCoreServer; 6 | 7 | namespace UdsChatServer 8 | { 9 | class ChatSession : UdsSession 10 | { 11 | public ChatSession(UdsServer server) : base(server) {} 12 | 13 | protected override void OnConnected() 14 | { 15 | Console.WriteLine($"Chat Unix Domain Socket session with Id {Id} connected!"); 16 | 17 | // Send invite message 18 | string message = "Hello from Unix Domain Socket chat! Please send a message or '!' to disconnect the client!"; 19 | SendAsync(message); 20 | } 21 | 22 | protected override void OnDisconnected() 23 | { 24 | Console.WriteLine($"Chat Unix Domain Socket session with Id {Id} disconnected!"); 25 | } 26 | 27 | protected override void OnReceived(byte[] buffer, long offset, long size) 28 | { 29 | string message = Encoding.UTF8.GetString(buffer, (int)offset, (int)size); 30 | Console.WriteLine("Incoming: " + message); 31 | 32 | // Multicast message to all connected sessions 33 | Server.Multicast(message); 34 | 35 | // If the buffer starts with '!' the disconnect the current session 36 | if (message == "!") 37 | Disconnect(); 38 | } 39 | 40 | protected override void OnError(SocketError error) 41 | { 42 | Console.WriteLine($"Chat Unix Domain Socket session caught an error with code {error}"); 43 | } 44 | } 45 | 46 | class ChatServer : UdsServer 47 | { 48 | public ChatServer(string path) : base(path) {} 49 | 50 | protected override UdsSession CreateSession() { return new ChatSession(this); } 51 | 52 | protected override void OnError(SocketError error) 53 | { 54 | Console.WriteLine($"Chat Unix Domain Socket server caught an error with code {error}"); 55 | } 56 | } 57 | 58 | class Program 59 | { 60 | static void Main(string[] args) 61 | { 62 | // Unix Domain Socket path 63 | string path = Path.Combine(Path.GetTempPath(), "chat.sock"); 64 | if (args.Length > 0) 65 | path = args[0]; 66 | 67 | Console.WriteLine($"Unix Domain Socket server path: {path}"); 68 | 69 | Console.WriteLine(); 70 | 71 | // Create a new Unix Domain Socket chat server 72 | var server = new ChatServer(path); 73 | 74 | // Start the server 75 | Console.Write("Server starting..."); 76 | server.Start(); 77 | Console.WriteLine("Done!"); 78 | 79 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 80 | 81 | // Perform text input 82 | for (;;) 83 | { 84 | string line = Console.ReadLine(); 85 | if (string.IsNullOrEmpty(line)) 86 | break; 87 | 88 | // Restart the server 89 | if (line == "!") 90 | { 91 | Console.Write("Server restarting..."); 92 | server.Restart(); 93 | Console.WriteLine("Done!"); 94 | continue; 95 | } 96 | 97 | // Multicast admin message to all sessions 98 | line = "(admin) " + line; 99 | server.Multicast(line); 100 | } 101 | 102 | // Stop the server 103 | Console.Write("Server stopping..."); 104 | server.Stop(); 105 | Console.WriteLine("Done!"); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /examples/UdsChatServer/UdsChatServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/WsChatClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Sockets; 3 | using System.Text; 4 | using System.Threading; 5 | using NetCoreServer; 6 | 7 | namespace WsChatClient 8 | { 9 | class ChatClient : WsClient 10 | { 11 | public ChatClient(string address, int port) : base(address, port) {} 12 | 13 | public void DisconnectAndStop() 14 | { 15 | _stop = true; 16 | CloseAsync(1000); 17 | while (IsConnected) 18 | Thread.Yield(); 19 | } 20 | 21 | public override void OnWsConnecting(HttpRequest request) 22 | { 23 | request.SetBegin("GET", "/"); 24 | request.SetHeader("Host", "localhost"); 25 | request.SetHeader("Origin", "http://localhost"); 26 | request.SetHeader("Upgrade", "websocket"); 27 | request.SetHeader("Connection", "Upgrade"); 28 | request.SetHeader("Sec-WebSocket-Key", Convert.ToBase64String(WsNonce)); 29 | request.SetHeader("Sec-WebSocket-Protocol", "chat, superchat"); 30 | request.SetHeader("Sec-WebSocket-Version", "13"); 31 | request.SetBody(); 32 | } 33 | 34 | public override void OnWsConnected(HttpResponse response) 35 | { 36 | Console.WriteLine($"Chat WebSocket client connected a new session with Id {Id}"); 37 | } 38 | 39 | public override void OnWsDisconnected() 40 | { 41 | Console.WriteLine($"Chat WebSocket client disconnected a session with Id {Id}"); 42 | } 43 | 44 | public override void OnWsReceived(byte[] buffer, long offset, long size) 45 | { 46 | Console.WriteLine($"Incoming: {Encoding.UTF8.GetString(buffer, (int)offset, (int)size)}"); 47 | } 48 | 49 | protected override void OnDisconnected() 50 | { 51 | base.OnDisconnected(); 52 | 53 | Console.WriteLine($"Chat WebSocket client disconnected a session with Id {Id}"); 54 | 55 | // Wait for a while... 56 | Thread.Sleep(1000); 57 | 58 | // Try to connect again 59 | if (!_stop) 60 | ConnectAsync(); 61 | } 62 | 63 | protected override void OnError(SocketError error) 64 | { 65 | Console.WriteLine($"Chat WebSocket client caught an error with code {error}"); 66 | } 67 | 68 | private bool _stop; 69 | } 70 | 71 | class Program 72 | { 73 | static void Main(string[] args) 74 | { 75 | // WebSocket server address 76 | string address = "127.0.0.1"; 77 | if (args.Length > 0) 78 | address = args[0]; 79 | 80 | // WebSocket server port 81 | int port = 8080; 82 | if (args.Length > 1) 83 | port = int.Parse(args[1]); 84 | 85 | Console.WriteLine($"WebSocket server address: {address}"); 86 | Console.WriteLine($"WebSocket server port: {port}"); 87 | 88 | Console.WriteLine(); 89 | 90 | // Create a new TCP chat client 91 | var client = new ChatClient(address, port); 92 | 93 | // Connect the client 94 | Console.Write("Client connecting..."); 95 | client.ConnectAsync(); 96 | Console.WriteLine("Done!"); 97 | 98 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 99 | 100 | // Perform text input 101 | for (;;) 102 | { 103 | string line = Console.ReadLine(); 104 | if (string.IsNullOrEmpty(line)) 105 | break; 106 | 107 | // Disconnect the client 108 | if (line == "!") 109 | { 110 | Console.Write("Client disconnecting..."); 111 | client.DisconnectAsync(); 112 | Console.WriteLine("Done!"); 113 | continue; 114 | } 115 | 116 | // Send the entered text to the chat server 117 | client.SendTextAsync(line); 118 | } 119 | 120 | // Disconnect the client 121 | Console.Write("Client disconnecting..."); 122 | client.DisconnectAndStop(); 123 | Console.WriteLine("Done!"); 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /examples/WsChatClient/WsChatClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/WsChatServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Text; 5 | using NetCoreServer; 6 | 7 | namespace WsChatServer 8 | { 9 | class ChatSession : WsSession 10 | { 11 | public ChatSession(WsServer server) : base(server) {} 12 | 13 | public override void OnWsConnected(HttpRequest request) 14 | { 15 | Console.WriteLine($"Chat WebSocket session with Id {Id} connected!"); 16 | 17 | // Send invite message 18 | string message = "Hello from WebSocket chat! Please send a message or '!' to disconnect the client!"; 19 | SendTextAsync(message); 20 | } 21 | 22 | public override void OnWsDisconnected() 23 | { 24 | Console.WriteLine($"Chat WebSocket session with Id {Id} disconnected!"); 25 | } 26 | 27 | public override void OnWsReceived(byte[] buffer, long offset, long size) 28 | { 29 | string message = Encoding.UTF8.GetString(buffer, (int)offset, (int)size); 30 | Console.WriteLine("Incoming: " + message); 31 | 32 | // Multicast message to all connected sessions 33 | ((WsServer)Server).MulticastText(message); 34 | 35 | // If the buffer starts with '!' the disconnect the current session 36 | if (message == "!") 37 | Close(); 38 | } 39 | 40 | protected override void OnError(SocketError error) 41 | { 42 | Console.WriteLine($"Chat WebSocket session caught an error with code {error}"); 43 | } 44 | } 45 | 46 | class ChatServer : WsServer 47 | { 48 | public ChatServer(IPAddress address, int port) : base(address, port) {} 49 | 50 | protected override TcpSession CreateSession() { return new ChatSession(this); } 51 | 52 | protected override void OnError(SocketError error) 53 | { 54 | Console.WriteLine($"Chat WebSocket server caught an error with code {error}"); 55 | } 56 | } 57 | 58 | class Program 59 | { 60 | static void Main(string[] args) 61 | { 62 | // WebSocket server port 63 | int port = 8080; 64 | if (args.Length > 0) 65 | port = int.Parse(args[0]); 66 | // WebSocket server content path 67 | string www = "../../../../../www/ws"; 68 | if (args.Length > 1) 69 | www = args[1]; 70 | 71 | Console.WriteLine($"WebSocket server port: {port}"); 72 | Console.WriteLine($"WebSocket server static content path: {www}"); 73 | Console.WriteLine($"WebSocket server website: http://localhost:{port}/chat/index.html"); 74 | 75 | Console.WriteLine(); 76 | 77 | // Create a new WebSocket server 78 | var server = new ChatServer(IPAddress.Any, port); 79 | server.AddStaticContent(www, "/chat"); 80 | 81 | // Start the server 82 | Console.Write("Server starting..."); 83 | server.Start(); 84 | Console.WriteLine("Done!"); 85 | 86 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 87 | 88 | // Perform text input 89 | for (;;) 90 | { 91 | string line = Console.ReadLine(); 92 | if (string.IsNullOrEmpty(line)) 93 | break; 94 | 95 | // Restart the server 96 | if (line == "!") 97 | { 98 | Console.Write("Server restarting..."); 99 | server.Restart(); 100 | Console.WriteLine("Done!"); 101 | } 102 | 103 | // Multicast admin message to all sessions 104 | line = "(admin) " + line; 105 | server.MulticastText(line); 106 | } 107 | 108 | // Stop the server 109 | Console.Write("Server stopping..."); 110 | server.Stop(); 111 | Console.WriteLine("Done!"); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /examples/WsChatServer/WsChatServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/WssChatClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Sockets; 3 | using System.Security.Authentication; 4 | using System.Security.Cryptography.X509Certificates; 5 | using System.Text; 6 | using System.Threading; 7 | using NetCoreServer; 8 | 9 | namespace WssChatClient 10 | { 11 | class ChatClient : WssClient 12 | { 13 | public ChatClient(SslContext context, string address, int port) : base(context, address, port) {} 14 | 15 | public void DisconnectAndStop() 16 | { 17 | _stop = true; 18 | CloseAsync(1000); 19 | while (IsConnected) 20 | Thread.Yield(); 21 | } 22 | 23 | public override void OnWsConnecting(HttpRequest request) 24 | { 25 | request.SetBegin("GET", "/"); 26 | request.SetHeader("Host", "localhost"); 27 | request.SetHeader("Origin", "http://localhost"); 28 | request.SetHeader("Upgrade", "websocket"); 29 | request.SetHeader("Connection", "Upgrade"); 30 | request.SetHeader("Sec-WebSocket-Key", Convert.ToBase64String(WsNonce)); 31 | request.SetHeader("Sec-WebSocket-Protocol", "chat, superchat"); 32 | request.SetHeader("Sec-WebSocket-Version", "13"); 33 | request.SetBody(); 34 | } 35 | 36 | public override void OnWsConnected(HttpResponse response) 37 | { 38 | Console.WriteLine($"Chat WebSocket client connected a new session with Id {Id}"); 39 | } 40 | 41 | public override void OnWsDisconnected() 42 | { 43 | Console.WriteLine($"Chat WebSocket client disconnected a session with Id {Id}"); 44 | } 45 | 46 | public override void OnWsReceived(byte[] buffer, long offset, long size) 47 | { 48 | Console.WriteLine($"Incoming: {Encoding.UTF8.GetString(buffer, (int)offset, (int)size)}"); 49 | } 50 | 51 | protected override void OnDisconnected() 52 | { 53 | base.OnDisconnected(); 54 | 55 | Console.WriteLine($"Chat WebSocket client disconnected a session with Id {Id}"); 56 | 57 | // Wait for a while... 58 | Thread.Sleep(1000); 59 | 60 | // Try to connect again 61 | if (!_stop) 62 | ConnectAsync(); 63 | } 64 | 65 | protected override void OnError(SocketError error) 66 | { 67 | Console.WriteLine($"Chat WebSocket client caught an error with code {error}"); 68 | } 69 | 70 | private bool _stop; 71 | } 72 | 73 | class Program 74 | { 75 | static void Main(string[] args) 76 | { 77 | // WebSocket server address 78 | string address = "127.0.0.1"; 79 | if (args.Length > 0) 80 | address = args[0]; 81 | 82 | // WebSocket server port 83 | int port = 8443; 84 | if (args.Length > 1) 85 | port = int.Parse(args[1]); 86 | 87 | Console.WriteLine($"WebSocket server address: {address}"); 88 | Console.WriteLine($"WebSocket server port: {port}"); 89 | 90 | Console.WriteLine(); 91 | 92 | // Create and prepare a new SSL client context 93 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("client.pfx", "qwerty"), (sender, certificate, chain, sslPolicyErrors) => true); 94 | 95 | // Create a new TCP chat client 96 | var client = new ChatClient(context, address, port); 97 | 98 | // Connect the client 99 | Console.Write("Client connecting..."); 100 | client.ConnectAsync(); 101 | Console.WriteLine("Done!"); 102 | 103 | Console.WriteLine("Press Enter to stop the client or '!' to reconnect the client..."); 104 | 105 | // Perform text input 106 | for (;;) 107 | { 108 | string line = Console.ReadLine(); 109 | if (string.IsNullOrEmpty(line)) 110 | break; 111 | 112 | // Reconnect the client 113 | if (line == "!") 114 | { 115 | Console.Write("Client reconnecting..."); 116 | if (client.IsConnected) 117 | client.ReconnectAsync(); 118 | else 119 | client.ConnectAsync(); 120 | Console.WriteLine("Done!"); 121 | continue; 122 | } 123 | 124 | // Send the entered text to the chat server 125 | client.SendTextAsync(line); 126 | } 127 | 128 | // Disconnect the client 129 | Console.Write("Client disconnecting..."); 130 | client.DisconnectAndStop(); 131 | Console.WriteLine("Done!"); 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /examples/WssChatClient/WssChatClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /examples/WssChatServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Security.Authentication; 5 | using System.Security.Cryptography.X509Certificates; 6 | using System.Text; 7 | using NetCoreServer; 8 | 9 | namespace WssChatServer 10 | { 11 | class ChatSession : WssSession 12 | { 13 | public ChatSession(WssServer server) : base(server) {} 14 | 15 | public override void OnWsConnected(HttpRequest request) 16 | { 17 | Console.WriteLine($"Chat WebSocket session with Id {Id} connected!"); 18 | 19 | // Send invite message 20 | string message = "Hello from WebSocket chat! Please send a message or '!' to disconnect the client!"; 21 | SendTextAsync(message); 22 | } 23 | 24 | public override void OnWsDisconnected() 25 | { 26 | Console.WriteLine($"Chat WebSocket session with Id {Id} disconnected!"); 27 | } 28 | 29 | public override void OnWsReceived(byte[] buffer, long offset, long size) 30 | { 31 | string message = Encoding.UTF8.GetString(buffer, (int)offset, (int)size); 32 | Console.WriteLine("Incoming: " + message); 33 | 34 | // Multicast message to all connected sessions 35 | ((WssServer)Server).MulticastText(message); 36 | 37 | // If the buffer starts with '!' the disconnect the current session 38 | if (message == "!") 39 | Close(); 40 | } 41 | 42 | protected override void OnError(SocketError error) 43 | { 44 | Console.WriteLine($"Chat WebSocket session caught an error with code {error}"); 45 | } 46 | } 47 | 48 | class ChatServer : WssServer 49 | { 50 | public ChatServer(SslContext context, IPAddress address, int port) : base(context, address, port) {} 51 | 52 | protected override SslSession CreateSession() { return new ChatSession(this); } 53 | 54 | protected override void OnError(SocketError error) 55 | { 56 | Console.WriteLine($"Chat WebSocket server caught an error with code {error}"); 57 | } 58 | } 59 | 60 | class Program 61 | { 62 | static void Main(string[] args) 63 | { 64 | // WebSocket server port 65 | int port = 8443; 66 | if (args.Length > 0) 67 | port = int.Parse(args[0]); 68 | // WebSocket server content path 69 | string www = "../../../../../www/wss"; 70 | if (args.Length > 1) 71 | www = args[1]; 72 | 73 | Console.WriteLine($"WebSocket server port: {port}"); 74 | Console.WriteLine($"WebSocket server static content path: {www}"); 75 | Console.WriteLine($"WebSocket server website: https://localhost:{port}/chat/index.html"); 76 | 77 | Console.WriteLine(); 78 | 79 | // Create and prepare a new SSL server context 80 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("server.pfx", "qwerty")); 81 | 82 | // Create a new WebSocket server 83 | var server = new ChatServer(context, IPAddress.Any, port); 84 | server.AddStaticContent(www, "/chat"); 85 | 86 | // Start the server 87 | Console.Write("Server starting..."); 88 | server.Start(); 89 | Console.WriteLine("Done!"); 90 | 91 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 92 | 93 | // Perform text input 94 | for (;;) 95 | { 96 | string line = Console.ReadLine(); 97 | if (string.IsNullOrEmpty(line)) 98 | break; 99 | 100 | // Restart the server 101 | if (line == "!") 102 | { 103 | Console.Write("Server restarting..."); 104 | server.Restart(); 105 | Console.WriteLine("Done!"); 106 | } 107 | 108 | // Multicast admin message to all sessions 109 | line = "(admin) " + line; 110 | server.MulticastText(line); 111 | } 112 | 113 | // Stop the server 114 | Console.Write("Server stopping..."); 115 | server.Stop(); 116 | Console.WriteLine("Done!"); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /examples/WssChatServer/WssChatServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | PreserveNewest 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /images/multicast.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/multicast.ai -------------------------------------------------------------------------------- /images/multicast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/multicast.png -------------------------------------------------------------------------------- /images/openapi-http.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/openapi-http.png -------------------------------------------------------------------------------- /images/openapi-https.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/openapi-https.png -------------------------------------------------------------------------------- /images/round-trip.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/round-trip.ai -------------------------------------------------------------------------------- /images/round-trip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/round-trip.png -------------------------------------------------------------------------------- /images/ws-chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/ws-chat.png -------------------------------------------------------------------------------- /images/wss-chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/images/wss-chat.png -------------------------------------------------------------------------------- /performance/HttpTraceClient/HttpTraceClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/HttpTraceServer/HttpTraceServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/HttpTraceServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using NetCoreServer; 5 | using NDesk.Options; 6 | 7 | namespace HttpTraceServer 8 | { 9 | class HttpTraceSession : HttpSession 10 | { 11 | public HttpTraceSession(HttpServer server) : base(server) {} 12 | 13 | protected override void OnReceivedRequest(HttpRequest request) 14 | { 15 | // Process HTTP request methods 16 | if (request.Method == "TRACE") 17 | SendResponseAsync(Response.MakeTraceResponse(request)); 18 | else 19 | SendResponseAsync(Response.MakeErrorResponse("Unsupported HTTP method: " + request.Method)); 20 | } 21 | 22 | protected override void OnReceivedRequestError(HttpRequest request, string error) 23 | { 24 | Console.WriteLine($"Request error: {error}"); 25 | } 26 | 27 | protected override void OnError(SocketError error) 28 | { 29 | Console.WriteLine($"Session caught an error with code {error}"); 30 | } 31 | } 32 | 33 | class HttpTraceServer : HttpServer 34 | { 35 | public HttpTraceServer(IPAddress address, int port) : base(address, port) {} 36 | 37 | protected override TcpSession CreateSession() { return new HttpTraceSession(this); } 38 | 39 | protected override void OnError(SocketError error) 40 | { 41 | Console.WriteLine($"Server caught an error with code {error}"); 42 | } 43 | } 44 | 45 | class Program 46 | { 47 | static void Main(string[] args) 48 | { 49 | bool help = false; 50 | int port = 8080; 51 | 52 | var options = new OptionSet() 53 | { 54 | { "h|?|help", v => help = v != null }, 55 | { "p|port=", v => port = int.Parse(v) } 56 | }; 57 | 58 | try 59 | { 60 | options.Parse(args); 61 | } 62 | catch (OptionException e) 63 | { 64 | Console.Write("Command line error: "); 65 | Console.WriteLine(e.Message); 66 | Console.WriteLine("Try `--help' to get usage information."); 67 | return; 68 | } 69 | 70 | if (help) 71 | { 72 | Console.WriteLine("Usage:"); 73 | options.WriteOptionDescriptions(Console.Out); 74 | return; 75 | } 76 | 77 | Console.WriteLine($"Server port: {port}"); 78 | 79 | Console.WriteLine(); 80 | 81 | // Create a new HTTP server 82 | var server = new HttpTraceServer(IPAddress.Any, port); 83 | // server.OptionNoDelay = true; 84 | server.OptionReuseAddress = true; 85 | 86 | // Start the server 87 | Console.Write("Server starting..."); 88 | server.Start(); 89 | Console.WriteLine("Done!"); 90 | 91 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 92 | 93 | // Perform text input 94 | for (;;) 95 | { 96 | string line = Console.ReadLine(); 97 | if (string.IsNullOrEmpty(line)) 98 | break; 99 | 100 | // Restart the server 101 | if (line == "!") 102 | { 103 | Console.Write("Server restarting..."); 104 | server.Restart(); 105 | Console.WriteLine("Done!"); 106 | } 107 | } 108 | 109 | // Stop the server 110 | Console.Write("Server stopping..."); 111 | server.Stop(); 112 | Console.WriteLine("Done!"); 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /performance/HttpsTraceClient/HttpsTraceClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/HttpsTraceServer/HttpsTraceServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/HttpsTraceServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Security.Authentication; 5 | using System.Security.Cryptography.X509Certificates; 6 | using NetCoreServer; 7 | using NDesk.Options; 8 | 9 | namespace HttpsTraceServer 10 | { 11 | class HttpsTraceSession : HttpsSession 12 | { 13 | public HttpsTraceSession(HttpsServer server) : base(server) {} 14 | 15 | protected override void OnReceivedRequest(HttpRequest request) 16 | { 17 | // Process HTTP request methods 18 | if (request.Method == "TRACE") 19 | SendResponseAsync(Response.MakeTraceResponse(request)); 20 | else 21 | SendResponseAsync(Response.MakeErrorResponse("Unsupported HTTP method: " + request.Method)); 22 | } 23 | 24 | protected override void OnReceivedRequestError(HttpRequest request, string error) 25 | { 26 | Console.WriteLine($"Request error: {error}"); 27 | } 28 | 29 | protected override void OnError(SocketError error) 30 | { 31 | Console.WriteLine($"Session caught an error with code {error}"); 32 | } 33 | } 34 | 35 | class HttpsTraceServer : HttpsServer 36 | { 37 | public HttpsTraceServer(SslContext context, IPAddress address, int port) : base(context, address, port) {} 38 | 39 | protected override SslSession CreateSession() { return new HttpsTraceSession(this); } 40 | 41 | protected override void OnError(SocketError error) 42 | { 43 | Console.WriteLine($"Server caught an error with code {error}"); 44 | } 45 | } 46 | 47 | class Program 48 | { 49 | static void Main(string[] args) 50 | { 51 | bool help = false; 52 | int port = 8443; 53 | 54 | var options = new OptionSet() 55 | { 56 | { "h|?|help", v => help = v != null }, 57 | { "p|port=", v => port = int.Parse(v) } 58 | }; 59 | 60 | try 61 | { 62 | options.Parse(args); 63 | } 64 | catch (OptionException e) 65 | { 66 | Console.Write("Command line error: "); 67 | Console.WriteLine(e.Message); 68 | Console.WriteLine("Try `--help' to get usage information."); 69 | return; 70 | } 71 | 72 | if (help) 73 | { 74 | Console.WriteLine("Usage:"); 75 | options.WriteOptionDescriptions(Console.Out); 76 | return; 77 | } 78 | 79 | Console.WriteLine($"Server port: {port}"); 80 | 81 | Console.WriteLine(); 82 | 83 | // Create and prepare a new SSL server context 84 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("server.pfx", "qwerty")); 85 | 86 | // Create a new HTTPS server 87 | var server = new HttpsTraceServer(context, IPAddress.Any, port); 88 | // server.OptionNoDelay = true; 89 | server.OptionReuseAddress = true; 90 | 91 | // Start the server 92 | Console.Write("Server starting..."); 93 | server.Start(); 94 | Console.WriteLine("Done!"); 95 | 96 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 97 | 98 | // Perform text input 99 | for (;;) 100 | { 101 | string line = Console.ReadLine(); 102 | if (string.IsNullOrEmpty(line)) 103 | break; 104 | 105 | // Restart the server 106 | if (line == "!") 107 | { 108 | Console.Write("Server restarting..."); 109 | server.Restart(); 110 | Console.WriteLine("Done!"); 111 | } 112 | } 113 | 114 | // Stop the server 115 | Console.Write("Server stopping..."); 116 | server.Stop(); 117 | Console.WriteLine("Done!"); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /performance/ProtoClient/ProtoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /performance/ProtoServer/ProtoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /performance/SslEchoClient/SslEchoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/SslEchoServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Security.Authentication; 5 | using System.Security.Cryptography.X509Certificates; 6 | using NetCoreServer; 7 | using NDesk.Options; 8 | 9 | namespace SslEchoServer 10 | { 11 | class EchoSession : SslSession 12 | { 13 | public EchoSession(SslServer server) : base(server) {} 14 | 15 | protected override void OnReceived(byte[] buffer, long offset, long size) 16 | { 17 | // Resend the message back to the client 18 | SendAsync(buffer, offset, size); 19 | } 20 | 21 | protected override void OnError(SocketError error) 22 | { 23 | Console.WriteLine($"Session caught an error with code {error}"); 24 | } 25 | } 26 | 27 | class EchoServer : SslServer 28 | { 29 | public EchoServer(SslContext context, IPAddress address, int port) : base(context, address, port) {} 30 | 31 | protected override SslSession CreateSession() { return new EchoSession(this); } 32 | 33 | protected override void OnError(SocketError error) 34 | { 35 | Console.WriteLine($"Server caught an error with code {error}"); 36 | } 37 | } 38 | 39 | class Program 40 | { 41 | static void Main(string[] args) 42 | { 43 | bool help = false; 44 | int port = 2222; 45 | 46 | var options = new OptionSet() 47 | { 48 | { "h|?|help", v => help = v != null }, 49 | { "p|port=", v => port = int.Parse(v) } 50 | }; 51 | 52 | try 53 | { 54 | options.Parse(args); 55 | } 56 | catch (OptionException e) 57 | { 58 | Console.Write("Command line error: "); 59 | Console.WriteLine(e.Message); 60 | Console.WriteLine("Try `--help' to get usage information."); 61 | return; 62 | } 63 | 64 | if (help) 65 | { 66 | Console.WriteLine("Usage:"); 67 | options.WriteOptionDescriptions(Console.Out); 68 | return; 69 | } 70 | 71 | Console.WriteLine($"Server port: {port}"); 72 | 73 | Console.WriteLine(); 74 | 75 | // Create and prepare a new SSL server context 76 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("server.pfx", "qwerty")); 77 | 78 | // Create a new echo server 79 | var server = new EchoServer(context, IPAddress.Any, port); 80 | // server.OptionNoDelay = true; 81 | server.OptionReuseAddress = true; 82 | 83 | // Start the server 84 | Console.Write("Server starting..."); 85 | server.Start(); 86 | Console.WriteLine("Done!"); 87 | 88 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 89 | 90 | // Perform text input 91 | for (;;) 92 | { 93 | string line = Console.ReadLine(); 94 | if (string.IsNullOrEmpty(line)) 95 | break; 96 | 97 | // Restart the server 98 | if (line == "!") 99 | { 100 | Console.Write("Server restarting..."); 101 | server.Restart(); 102 | Console.WriteLine("Done!"); 103 | } 104 | } 105 | 106 | // Stop the server 107 | Console.Write("Server stopping..."); 108 | server.Stop(); 109 | Console.WriteLine("Done!"); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /performance/SslEchoServer/SslEchoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/SslMulticastClient/SslMulticastClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/SslMulticastServer/SslMulticastServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/TcpEchoClient/TcpEchoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/TcpEchoServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using NetCoreServer; 5 | using NDesk.Options; 6 | 7 | namespace TcpEchoServer 8 | { 9 | class EchoSession : TcpSession 10 | { 11 | public EchoSession(TcpServer server) : base(server) {} 12 | 13 | protected override void OnReceived(byte[] buffer, long offset, long size) 14 | { 15 | // Resend the message back to the client 16 | SendAsync(buffer, offset, size); 17 | } 18 | 19 | protected override void OnError(SocketError error) 20 | { 21 | Console.WriteLine($"Session caught an error with code {error}"); 22 | } 23 | } 24 | 25 | class EchoServer : TcpServer 26 | { 27 | public EchoServer(IPAddress address, int port) : base(address, port) {} 28 | 29 | protected override TcpSession CreateSession() { return new EchoSession(this); } 30 | 31 | protected override void OnError(SocketError error) 32 | { 33 | Console.WriteLine($"Server caught an error with code {error}"); 34 | } 35 | } 36 | 37 | class Program 38 | { 39 | static void Main(string[] args) 40 | { 41 | bool help = false; 42 | int port = 1111; 43 | 44 | var options = new OptionSet() 45 | { 46 | { "h|?|help", v => help = v != null }, 47 | { "p|port=", v => port = int.Parse(v) } 48 | }; 49 | 50 | try 51 | { 52 | options.Parse(args); 53 | } 54 | catch (OptionException e) 55 | { 56 | Console.Write("Command line error: "); 57 | Console.WriteLine(e.Message); 58 | Console.WriteLine("Try `--help' to get usage information."); 59 | return; 60 | } 61 | 62 | if (help) 63 | { 64 | Console.WriteLine("Usage:"); 65 | options.WriteOptionDescriptions(Console.Out); 66 | return; 67 | } 68 | 69 | Console.WriteLine($"Server port: {port}"); 70 | 71 | Console.WriteLine(); 72 | 73 | // Create a new echo server 74 | var server = new EchoServer(IPAddress.Any, port); 75 | // server.OptionNoDelay = true; 76 | server.OptionReuseAddress = true; 77 | 78 | // Start the server 79 | Console.Write("Server starting..."); 80 | server.Start(); 81 | Console.WriteLine("Done!"); 82 | 83 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 84 | 85 | // Perform text input 86 | for (;;) 87 | { 88 | string line = Console.ReadLine(); 89 | if (string.IsNullOrEmpty(line)) 90 | break; 91 | 92 | // Restart the server 93 | if (line == "!") 94 | { 95 | Console.Write("Server restarting..."); 96 | server.Restart(); 97 | Console.WriteLine("Done!"); 98 | } 99 | } 100 | 101 | // Stop the server 102 | Console.Write("Server stopping..."); 103 | server.Stop(); 104 | Console.WriteLine("Done!"); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /performance/TcpEchoServer/TcpEchoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/TcpMulticastClient/TcpMulticastClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/TcpMulticastServer/TcpMulticastServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdpEchoClient/UdpEchoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdpEchoServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Threading; 5 | using NetCoreServer; 6 | using NDesk.Options; 7 | 8 | namespace UdpEchoServer 9 | { 10 | class EchoServer : UdpServer 11 | { 12 | public EchoServer(IPAddress address, int port) : base(address, port) {} 13 | 14 | protected override void OnStarted() 15 | { 16 | // Start receive datagrams 17 | ReceiveAsync(); 18 | } 19 | 20 | protected override void OnReceived(EndPoint endpoint, byte[] buffer, long offset, long size) 21 | { 22 | // Continue receive datagrams. 23 | if (size == 0) 24 | { 25 | // Important: Receive using thread pool is necessary here to avoid stack overflow with Socket.ReceiveFromAsync() method! 26 | ThreadPool.QueueUserWorkItem(o => { ReceiveAsync(); }); 27 | } 28 | 29 | // Echo the message back to the sender 30 | SendAsync(endpoint, buffer, offset, size); 31 | } 32 | 33 | protected override void OnSent(EndPoint endpoint, long sent) 34 | { 35 | // Continue receive datagrams. 36 | // Important: Receive using thread pool is necessary here to avoid stack overflow with Socket.ReceiveFromAsync() method! 37 | ThreadPool.QueueUserWorkItem(o => { ReceiveAsync(); } ); 38 | } 39 | 40 | protected override void OnError(SocketError error) 41 | { 42 | Console.WriteLine($"Server caught an error with code {error}"); 43 | } 44 | } 45 | 46 | class Program 47 | { 48 | static void Main(string[] args) 49 | { 50 | bool help = false; 51 | int port = 3333; 52 | 53 | var options = new OptionSet() 54 | { 55 | { "h|?|help", v => help = v != null }, 56 | { "p|port=", v => port = int.Parse(v) } 57 | }; 58 | 59 | try 60 | { 61 | options.Parse(args); 62 | } 63 | catch (OptionException e) 64 | { 65 | Console.Write("Command line error: "); 66 | Console.WriteLine(e.Message); 67 | Console.WriteLine("Try `--help' to get usage information."); 68 | return; 69 | } 70 | 71 | if (help) 72 | { 73 | Console.WriteLine("Usage:"); 74 | options.WriteOptionDescriptions(Console.Out); 75 | return; 76 | } 77 | 78 | Console.WriteLine($"Server port: {port}"); 79 | 80 | Console.WriteLine(); 81 | 82 | // Create a new echo server 83 | var server = new EchoServer(IPAddress.Any, port); 84 | server.OptionReuseAddress = true; 85 | 86 | // Start the server 87 | Console.Write("Server starting..."); 88 | server.Start(); 89 | Console.WriteLine("Done!"); 90 | 91 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 92 | 93 | // Perform text input 94 | for (;;) 95 | { 96 | string line = Console.ReadLine(); 97 | if (string.IsNullOrEmpty(line)) 98 | break; 99 | 100 | // Restart the server 101 | if (line == "!") 102 | { 103 | Console.Write("Server restarting..."); 104 | server.Restart(); 105 | Console.WriteLine("Done!"); 106 | } 107 | } 108 | 109 | // Stop the server 110 | Console.Write("Server stopping..."); 111 | server.Stop(); 112 | Console.WriteLine("Done!"); 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /performance/UdpEchoServer/UdpEchoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdpMulticastClient/UdpMulticastClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdpMulticastServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using NetCoreServer; 7 | using NDesk.Options; 8 | 9 | namespace UdpMulticastServer 10 | { 11 | class MulticastServer : UdpServer 12 | { 13 | public MulticastServer(IPAddress address, int port) : base(address, port) {} 14 | 15 | protected override void OnError(SocketError error) 16 | { 17 | Console.WriteLine($"Server caught an error with code {error}"); 18 | } 19 | } 20 | 21 | class Program 22 | { 23 | static void Main(string[] args) 24 | { 25 | bool help = false; 26 | string address = "239.255.0.1"; 27 | int port = 3333; 28 | int messagesRate = 1000000; 29 | int messageSize = 32; 30 | 31 | var options = new OptionSet() 32 | { 33 | { "h|?|help", v => help = v != null }, 34 | { "a|address=", v => address = v }, 35 | { "p|port=", v => port = int.Parse(v) }, 36 | { "m|messages=", v => messagesRate = int.Parse(v) }, 37 | { "s|size=", v => messageSize = int.Parse(v) } 38 | }; 39 | 40 | try 41 | { 42 | options.Parse(args); 43 | } 44 | catch (OptionException e) 45 | { 46 | Console.Write("Command line error: "); 47 | Console.WriteLine(e.Message); 48 | Console.WriteLine("Try `--help' to get usage information."); 49 | return; 50 | } 51 | 52 | if (help) 53 | { 54 | Console.WriteLine("Usage:"); 55 | options.WriteOptionDescriptions(Console.Out); 56 | return; 57 | } 58 | 59 | Console.WriteLine($"Server address: {address}"); 60 | Console.WriteLine($"Server port: {port}"); 61 | Console.WriteLine($"Messages rate: {messagesRate}"); 62 | Console.WriteLine($"Message size: {messageSize}"); 63 | 64 | Console.WriteLine(); 65 | 66 | // Create a new echo server 67 | var server = new MulticastServer(IPAddress.Any, 0); 68 | server.OptionReuseAddress = true; 69 | 70 | // Start the server 71 | Console.Write("Server starting..."); 72 | server.Start(address, port); 73 | Console.WriteLine("Done!"); 74 | 75 | // Start the multicasting thread 76 | bool multicasting = true; 77 | var multicaster = Task.Factory.StartNew(() => 78 | { 79 | // Prepare message to multicast 80 | byte[] message = new byte[messageSize]; 81 | 82 | // Multicasting loop 83 | while (multicasting) 84 | { 85 | var start = DateTime.UtcNow; 86 | for (int i = 0; i < messagesRate; i++) 87 | server.Multicast(message); 88 | var end = DateTime.UtcNow; 89 | 90 | // Sleep for remaining time or yield 91 | var milliseconds = (int)(end - start).TotalMilliseconds; 92 | if (milliseconds < 1000) 93 | Thread.Sleep(1000 - milliseconds); 94 | else 95 | Thread.Yield(); 96 | } 97 | }); 98 | 99 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 100 | 101 | // Perform text input 102 | for (;;) 103 | { 104 | string line = Console.ReadLine(); 105 | if (string.IsNullOrEmpty(line)) 106 | break; 107 | 108 | // Restart the server 109 | if (line == "!") 110 | { 111 | Console.Write("Server restarting..."); 112 | server.Restart(); 113 | Console.WriteLine("Done!"); 114 | } 115 | } 116 | 117 | // Stop the multicasting thread 118 | multicasting = false; 119 | multicaster.Wait(); 120 | 121 | // Stop the server 122 | Console.Write("Server stopping..."); 123 | server.Stop(); 124 | Console.WriteLine("Done!"); 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /performance/UdpMulticastServer/UdpMulticastServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdsEchoClient/UdsEchoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdsEchoServer/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net.Sockets; 4 | using NetCoreServer; 5 | using NDesk.Options; 6 | 7 | namespace UdsEchoServer 8 | { 9 | class EchoSession : UdsSession 10 | { 11 | public EchoSession(UdsServer server) : base(server) {} 12 | 13 | protected override void OnReceived(byte[] buffer, long offset, long size) 14 | { 15 | // Resend the message back to the client 16 | SendAsync(buffer, offset, size); 17 | } 18 | 19 | protected override void OnError(SocketError error) 20 | { 21 | Console.WriteLine($"Session caught an error with code {error}"); 22 | } 23 | } 24 | 25 | class EchoServer : UdsServer 26 | { 27 | public EchoServer(string path) : base(path) {} 28 | 29 | protected override UdsSession CreateSession() { return new EchoSession(this); } 30 | 31 | protected override void OnError(SocketError error) 32 | { 33 | Console.WriteLine($"Server caught an error with code {error}"); 34 | } 35 | } 36 | 37 | class Program 38 | { 39 | static void Main(string[] args) 40 | { 41 | bool help = false; 42 | string path = Path.Combine(Path.GetTempPath(), "echo.sock"); 43 | 44 | var options = new OptionSet() 45 | { 46 | { "h|?|help", v => help = v != null }, 47 | { "p|path=", v => path = v } 48 | }; 49 | 50 | try 51 | { 52 | options.Parse(args); 53 | } 54 | catch (OptionException e) 55 | { 56 | Console.Write("Command line error: "); 57 | Console.WriteLine(e.Message); 58 | Console.WriteLine("Try `--help' to get usage information."); 59 | return; 60 | } 61 | 62 | if (help) 63 | { 64 | Console.WriteLine("Usage:"); 65 | options.WriteOptionDescriptions(Console.Out); 66 | return; 67 | } 68 | 69 | Console.WriteLine($"Server Unix Domain Socket path: {path}"); 70 | 71 | Console.WriteLine(); 72 | 73 | // Create a new echo server 74 | var server = new EchoServer(path); 75 | 76 | // Start the server 77 | Console.Write("Server starting..."); 78 | server.Start(); 79 | Console.WriteLine("Done!"); 80 | 81 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 82 | 83 | // Perform text input 84 | for (;;) 85 | { 86 | string line = Console.ReadLine(); 87 | if (string.IsNullOrEmpty(line)) 88 | break; 89 | 90 | // Restart the server 91 | if (line == "!") 92 | { 93 | Console.Write("Server restarting..."); 94 | server.Restart(); 95 | Console.WriteLine("Done!"); 96 | } 97 | } 98 | 99 | // Stop the server 100 | Console.Write("Server stopping..."); 101 | server.Stop(); 102 | Console.WriteLine("Done!"); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /performance/UdsEchoServer/UdsEchoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdsMulticastClient/UdsMulticastClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/UdsMulticastServer/UdsMulticastServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/WsEchoClient/WsEchoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/WsEchoServer/Program.cs: -------------------------------------------------------------------------------- 1 | using NDesk.Options; 2 | using NetCoreServer; 3 | using System; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | 7 | namespace WsEchoServer 8 | { 9 | class EchoSession : WsSession 10 | { 11 | public EchoSession(WsServer server) : base(server) {} 12 | 13 | public override void OnWsReceived(byte[] buffer, long offset, long size) 14 | { 15 | // Resend the message back to the client 16 | SendBinaryAsync(buffer, offset, size); 17 | } 18 | 19 | protected override void OnError(SocketError error) 20 | { 21 | Console.WriteLine($"Session caught an error with code {error}"); 22 | } 23 | } 24 | 25 | class EchoServer : WsServer 26 | { 27 | public EchoServer(IPAddress address, int port) : base(address, port) {} 28 | 29 | protected override TcpSession CreateSession() { return new EchoSession(this); } 30 | 31 | protected override void OnError(SocketError error) 32 | { 33 | Console.WriteLine($"Server caught an error with code {error}"); 34 | } 35 | } 36 | 37 | class Program 38 | { 39 | static void Main(string[] args) 40 | { 41 | bool help = false; 42 | int port = 8080; 43 | 44 | var options = new OptionSet() 45 | { 46 | { "h|?|help", v => help = v != null }, 47 | { "p|port=", v => port = int.Parse(v) } 48 | }; 49 | 50 | try 51 | { 52 | options.Parse(args); 53 | } 54 | catch (OptionException e) 55 | { 56 | Console.Write("Command line error: "); 57 | Console.WriteLine(e.Message); 58 | Console.WriteLine("Try `--help' to get usage information."); 59 | return; 60 | } 61 | 62 | if (help) 63 | { 64 | Console.WriteLine("Usage:"); 65 | options.WriteOptionDescriptions(Console.Out); 66 | return; 67 | } 68 | 69 | Console.WriteLine($"Server port: {port}"); 70 | 71 | Console.WriteLine(); 72 | 73 | // Create a new echo server 74 | var server = new EchoServer(IPAddress.Any, port); 75 | // server.OptionNoDelay = true; 76 | server.OptionReuseAddress = true; 77 | 78 | // Start the server 79 | Console.Write("Server starting..."); 80 | server.Start(); 81 | Console.WriteLine("Done!"); 82 | 83 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 84 | 85 | // Perform text input 86 | for (;;) 87 | { 88 | string line = Console.ReadLine(); 89 | if (string.IsNullOrEmpty(line)) 90 | break; 91 | 92 | // Restart the server 93 | if (line == "!") 94 | { 95 | Console.Write("Server restarting..."); 96 | server.Restart(); 97 | Console.WriteLine("Done!"); 98 | } 99 | } 100 | 101 | // Stop the server 102 | Console.Write("Server stopping..."); 103 | server.Stop(); 104 | Console.WriteLine("Done!"); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /performance/WsEchoServer/WsEchoServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/WsMulticastClient/WsMulticastClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/WsMulticastServer/Program.cs: -------------------------------------------------------------------------------- 1 | using NDesk.Options; 2 | using NetCoreServer; 3 | using System; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace WsMulticastServer 10 | { 11 | class MulticastSession : WsSession 12 | { 13 | public MulticastSession(WsServer server) : base(server) {} 14 | 15 | protected override void OnError(SocketError error) 16 | { 17 | Console.WriteLine($"Session caught an error with code {error}"); 18 | } 19 | } 20 | 21 | class MulticastServer : WsServer 22 | { 23 | public MulticastServer(IPAddress address, int port) : base(address, port) {} 24 | 25 | protected override TcpSession CreateSession() { return new MulticastSession(this); } 26 | 27 | protected override void OnError(SocketError error) 28 | { 29 | Console.WriteLine($"Server caught an error with code {error}"); 30 | } 31 | } 32 | 33 | class Program 34 | { 35 | static void Main(string[] args) 36 | { 37 | bool help = false; 38 | int port = 8080; 39 | int messagesRate = 1000000; 40 | int messageSize = 32; 41 | 42 | var options = new OptionSet() 43 | { 44 | { "h|?|help", v => help = v != null }, 45 | { "p|port=", v => port = int.Parse(v) }, 46 | { "m|messages=", v => messagesRate = int.Parse(v) }, 47 | { "s|size=", v => messageSize = int.Parse(v) } 48 | }; 49 | 50 | try 51 | { 52 | options.Parse(args); 53 | } 54 | catch (OptionException e) 55 | { 56 | Console.Write("Command line error: "); 57 | Console.WriteLine(e.Message); 58 | Console.WriteLine("Try `--help' to get usage information."); 59 | return; 60 | } 61 | 62 | if (help) 63 | { 64 | Console.WriteLine("Usage:"); 65 | options.WriteOptionDescriptions(Console.Out); 66 | return; 67 | } 68 | 69 | Console.WriteLine($"Server port: {port}"); 70 | Console.WriteLine($"Messages rate: {messagesRate}"); 71 | Console.WriteLine($"Message size: {messageSize}"); 72 | 73 | Console.WriteLine(); 74 | 75 | // Create a new echo server 76 | var server = new MulticastServer(IPAddress.Any, port); 77 | // server.OptionNoDelay = true; 78 | server.OptionReuseAddress = true; 79 | 80 | // Start the server 81 | Console.Write("Server starting..."); 82 | server.Start(); 83 | Console.WriteLine("Done!"); 84 | 85 | // Start the multicasting thread 86 | bool multicasting = true; 87 | var multicaster = Task.Factory.StartNew(() => 88 | { 89 | // Prepare message to multicast 90 | byte[] message = new byte[messageSize]; 91 | 92 | // Multicasting loop 93 | while (multicasting) 94 | { 95 | var start = DateTime.UtcNow; 96 | for (int i = 0; i < messagesRate; i++) 97 | server.MulticastBinary(message, 0, message.Length); 98 | var end = DateTime.UtcNow; 99 | 100 | // Sleep for remaining time or yield 101 | var milliseconds = (int)(end - start).TotalMilliseconds; 102 | if (milliseconds < 1000) 103 | Thread.Sleep(1000 - milliseconds); 104 | else 105 | Thread.Yield(); 106 | } 107 | }); 108 | 109 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 110 | 111 | // Perform text input 112 | for (;;) 113 | { 114 | string line = Console.ReadLine(); 115 | if (string.IsNullOrEmpty(line)) 116 | break; 117 | 118 | // Restart the server 119 | if (line == "!") 120 | { 121 | Console.Write("Server restarting..."); 122 | server.Restart(); 123 | Console.WriteLine("Done!"); 124 | } 125 | } 126 | 127 | // Stop the multicasting thread 128 | multicasting = false; 129 | multicaster.Wait(); 130 | 131 | // Stop the server 132 | Console.Write("Server stopping..."); 133 | server.Stop(); 134 | Console.WriteLine("Done!"); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /performance/WsMulticastServer/WsMulticastServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /performance/WssEchoClient/WssEchoClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/WssEchoServer/Program.cs: -------------------------------------------------------------------------------- 1 | using NDesk.Options; 2 | using NetCoreServer; 3 | using System; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using System.Security.Authentication; 7 | using System.Security.Cryptography.X509Certificates; 8 | 9 | namespace WssEchoServer 10 | { 11 | class EchoSession : WssSession 12 | { 13 | public EchoSession(WssServer server) : base(server) {} 14 | 15 | public override void OnWsReceived(byte[] buffer, long offset, long size) 16 | { 17 | // Resend the message back to the client 18 | SendBinaryAsync(buffer, offset, size); 19 | } 20 | 21 | protected override void OnError(SocketError error) 22 | { 23 | Console.WriteLine($"Session caught an error with code {error}"); 24 | } 25 | } 26 | 27 | class EchoServer : WssServer 28 | { 29 | public EchoServer(SslContext context, IPAddress address, int port) : base(context, address, port) {} 30 | 31 | protected override SslSession CreateSession() { return new EchoSession(this); } 32 | 33 | protected override void OnError(SocketError error) 34 | { 35 | Console.WriteLine($"Server caught an error with code {error}"); 36 | } 37 | } 38 | 39 | class Program 40 | { 41 | static void Main(string[] args) 42 | { 43 | bool help = false; 44 | int port = 8443; 45 | 46 | var options = new OptionSet() 47 | { 48 | { "h|?|help", v => help = v != null }, 49 | { "p|port=", v => port = int.Parse(v) } 50 | }; 51 | 52 | try 53 | { 54 | options.Parse(args); 55 | } 56 | catch (OptionException e) 57 | { 58 | Console.Write("Command line error: "); 59 | Console.WriteLine(e.Message); 60 | Console.WriteLine("Try `--help' to get usage information."); 61 | return; 62 | } 63 | 64 | if (help) 65 | { 66 | Console.WriteLine("Usage:"); 67 | options.WriteOptionDescriptions(Console.Out); 68 | return; 69 | } 70 | 71 | Console.WriteLine($"Server port: {port}"); 72 | 73 | Console.WriteLine(); 74 | 75 | // Create and prepare a new SSL server context 76 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("server.pfx", "qwerty")); 77 | 78 | // Create a new echo server 79 | var server = new EchoServer(context, IPAddress.Any, port); 80 | // server.OptionNoDelay = true; 81 | server.OptionReuseAddress = true; 82 | 83 | // Start the server 84 | Console.Write("Server starting..."); 85 | server.Start(); 86 | Console.WriteLine("Done!"); 87 | 88 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 89 | 90 | // Perform text input 91 | for (;;) 92 | { 93 | string line = Console.ReadLine(); 94 | if (string.IsNullOrEmpty(line)) 95 | break; 96 | 97 | // Restart the server 98 | if (line == "!") 99 | { 100 | Console.Write("Server restarting..."); 101 | server.Restart(); 102 | Console.WriteLine("Done!"); 103 | } 104 | } 105 | 106 | // Stop the server 107 | Console.Write("Server stopping..."); 108 | server.Stop(); 109 | Console.WriteLine("Done!"); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /performance/WssEchoServer/WssEchoServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/WssMulticastClient/WssMulticastClient.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /performance/WssMulticastServer/Program.cs: -------------------------------------------------------------------------------- 1 | using NDesk.Options; 2 | using NetCoreServer; 3 | using System; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using System.Security.Authentication; 7 | using System.Security.Cryptography.X509Certificates; 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | 11 | namespace WssMulticastServer 12 | { 13 | class MulticastSession : WssSession 14 | { 15 | public MulticastSession(WssServer server) : base(server) {} 16 | 17 | protected override void OnError(SocketError error) 18 | { 19 | Console.WriteLine($"Session caught an error with code {error}"); 20 | } 21 | } 22 | 23 | class MulticastServer : WssServer 24 | { 25 | public MulticastServer(SslContext context, IPAddress address, int port) : base(context, address, port) {} 26 | 27 | protected override SslSession CreateSession() { return new MulticastSession(this); } 28 | 29 | protected override void OnError(SocketError error) 30 | { 31 | Console.WriteLine($"Server caught an error with code {error}"); 32 | } 33 | } 34 | 35 | class Program 36 | { 37 | static void Main(string[] args) 38 | { 39 | bool help = false; 40 | int port = 8443; 41 | int messagesRate = 1000000; 42 | int messageSize = 32; 43 | 44 | var options = new OptionSet() 45 | { 46 | { "h|?|help", v => help = v != null }, 47 | { "p|port=", v => port = int.Parse(v) }, 48 | { "m|messages=", v => messagesRate = int.Parse(v) }, 49 | { "s|size=", v => messageSize = int.Parse(v) } 50 | }; 51 | 52 | try 53 | { 54 | options.Parse(args); 55 | } 56 | catch (OptionException e) 57 | { 58 | Console.Write("Command line error: "); 59 | Console.WriteLine(e.Message); 60 | Console.WriteLine("Try `--help' to get usage information."); 61 | return; 62 | } 63 | 64 | if (help) 65 | { 66 | Console.WriteLine("Usage:"); 67 | options.WriteOptionDescriptions(Console.Out); 68 | return; 69 | } 70 | 71 | Console.WriteLine($"Server port: {port}"); 72 | Console.WriteLine($"Messages rate: {messagesRate}"); 73 | Console.WriteLine($"Message size: {messageSize}"); 74 | 75 | Console.WriteLine(); 76 | 77 | // Create and prepare a new SSL server context 78 | var context = new SslContext(SslProtocols.Tls13, new X509Certificate2("server.pfx", "qwerty"), (sender, certificate, chain, sslPolicyErrors) => true); 79 | 80 | // Create a new echo server 81 | var server = new MulticastServer(context, IPAddress.Any, port); 82 | // server.OptionNoDelay = true; 83 | server.OptionReuseAddress = true; 84 | 85 | // Start the server 86 | Console.Write("Server starting..."); 87 | server.Start(); 88 | Console.WriteLine("Done!"); 89 | 90 | // Start the multicasting thread 91 | bool multicasting = true; 92 | var multicaster = Task.Factory.StartNew(() => 93 | { 94 | // Prepare message to multicast 95 | byte[] message = new byte[messageSize]; 96 | 97 | // Multicasting loop 98 | while (multicasting) 99 | { 100 | var start = DateTime.UtcNow; 101 | for (int i = 0; i < messagesRate; i++) 102 | server.MulticastBinary(message, 0, message.Length); 103 | var end = DateTime.UtcNow; 104 | 105 | // Sleep for remaining time or yield 106 | var milliseconds = (int)(end - start).TotalMilliseconds; 107 | if (milliseconds < 1000) 108 | Thread.Sleep(1000 - milliseconds); 109 | else 110 | Thread.Yield(); 111 | } 112 | }); 113 | 114 | Console.WriteLine("Press Enter to stop the server or '!' to restart the server..."); 115 | 116 | // Perform text input 117 | for (;;) 118 | { 119 | string line = Console.ReadLine(); 120 | if (string.IsNullOrEmpty(line)) 121 | break; 122 | 123 | // Restart the server 124 | if (line == "!") 125 | { 126 | Console.Write("Server restarting..."); 127 | server.Restart(); 128 | Console.WriteLine("Done!"); 129 | } 130 | } 131 | 132 | // Stop the multicasting thread 133 | multicasting = false; 134 | multicaster.Wait(); 135 | 136 | // Stop the server 137 | Console.Write("Server stopping..."); 138 | server.Stop(); 139 | Console.WriteLine("Done!"); 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /performance/WssMulticastServer/WssMulticastServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /proto/proto.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net8.0 4 | 5 | -------------------------------------------------------------------------------- /proto/simple.fbe: -------------------------------------------------------------------------------- 1 | /* 2 | Simple Fast Binary Encoding protocol for CppServer 3 | https://github.com/chronoxor/FastBinaryEncoding 4 | 5 | Generate protocol command: fbec --csharp --proto --input=simple.fbe --output=. 6 | */ 7 | 8 | // Domain declaration 9 | domain com.chronoxor 10 | 11 | // Package declaration 12 | package simple 13 | 14 | // Protocol version 15 | version 1.0 16 | 17 | // Simple request message 18 | [request] 19 | [response(SimpleResponse)] 20 | [reject(SimpleReject)] 21 | message SimpleRequest 22 | { 23 | // Request Id 24 | uuid [id] = uuid1; 25 | // Request message 26 | string Message; 27 | } 28 | 29 | // Simple response 30 | message SimpleResponse 31 | { 32 | // Response Id 33 | uuid [id] = uuid1; 34 | // Calculated message length 35 | uint32 Length; 36 | // Calculated message hash 37 | uint32 Hash; 38 | } 39 | 40 | // Simple reject 41 | message SimpleReject 42 | { 43 | // Reject Id 44 | uuid [id] = uuid1; 45 | // Error message 46 | string Error; 47 | } 48 | 49 | // Simple notification 50 | message SimpleNotify 51 | { 52 | // Server notification 53 | string Notification; 54 | } 55 | 56 | // Disconnect request message 57 | [request] 58 | message DisconnectRequest 59 | { 60 | // Request Id 61 | uuid [id] = uuid1; 62 | } 63 | -------------------------------------------------------------------------------- /source/NetCoreServer/HttpServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.IO; 4 | 5 | namespace NetCoreServer 6 | { 7 | /// 8 | /// HTTP server is used to create HTTP Web server and communicate with clients using HTTP protocol. It allows to receive GET, POST, PUT, DELETE requests and send HTTP responses. 9 | /// 10 | /// Thread-safe. 11 | public class HttpServer : TcpServer 12 | { 13 | /// 14 | /// Initialize HTTP server with a given IP address and port number 15 | /// 16 | /// IP address 17 | /// Port number 18 | public HttpServer(IPAddress address, int port) : base(address, port) { Cache = new FileCache(); } 19 | /// 20 | /// Initialize HTTP server with a given IP address and port number 21 | /// 22 | /// IP address 23 | /// Port number 24 | public HttpServer(string address, int port) : base(address, port) { Cache = new FileCache(); } 25 | /// 26 | /// Initialize HTTP server with a given DNS endpoint 27 | /// 28 | /// DNS endpoint 29 | public HttpServer(DnsEndPoint endpoint) : base(endpoint) { Cache = new FileCache(); } 30 | /// 31 | /// Initialize HTTP server with a given IP endpoint 32 | /// 33 | /// IP endpoint 34 | public HttpServer(IPEndPoint endpoint) : base(endpoint) { Cache = new FileCache(); } 35 | 36 | /// 37 | /// Get the static content cache 38 | /// 39 | public FileCache Cache { get; } 40 | 41 | /// 42 | /// Add static content cache 43 | /// 44 | /// Static content path 45 | /// Cache prefix (default is "/") 46 | /// Cache filter (default is "*.*") 47 | /// Refresh cache timeout (default is 1 hour) 48 | public void AddStaticContent(string path, string prefix = "/", string filter = "*.*", TimeSpan? timeout = null) 49 | { 50 | timeout ??= TimeSpan.FromHours(1); 51 | 52 | bool Handler(FileCache cache, string key, byte[] value, TimeSpan timespan) 53 | { 54 | var response = new HttpResponse(); 55 | response.SetBegin(200); 56 | response.SetContentType(Path.GetExtension(key)); 57 | response.SetHeader("Cache-Control", $"max-age={timespan.Seconds}"); 58 | response.SetBody(value); 59 | return cache.Add(key, response.Cache.Data, timespan); 60 | } 61 | 62 | Cache.InsertPath(path, prefix, filter, timeout.Value, Handler); 63 | } 64 | /// 65 | /// Remove static content cache 66 | /// 67 | /// Static content path 68 | public void RemoveStaticContent(string path) { Cache.RemovePath(path); } 69 | /// 70 | /// Clear static content cache 71 | /// 72 | public void ClearStaticContent() { Cache.Clear(); } 73 | 74 | protected override TcpSession CreateSession() { return new HttpSession(this); } 75 | 76 | #region IDisposable implementation 77 | 78 | // Disposed flag. 79 | private bool _disposed; 80 | 81 | protected override void Dispose(bool disposingManagedResources) 82 | { 83 | if (!_disposed) 84 | { 85 | if (disposingManagedResources) 86 | { 87 | // Dispose managed resources here... 88 | Cache.Dispose(); 89 | } 90 | 91 | // Dispose unmanaged resources here... 92 | 93 | // Set large fields to null here... 94 | 95 | // Mark as disposed. 96 | _disposed = true; 97 | } 98 | 99 | // Call Dispose in the base class. 100 | base.Dispose(disposingManagedResources); 101 | } 102 | 103 | // The derived class does not have a Finalize method 104 | // or a Dispose method without parameters because it inherits 105 | // them from the base class. 106 | 107 | #endregion 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /source/NetCoreServer/HttpsServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | 5 | namespace NetCoreServer 6 | { 7 | /// 8 | /// HTTPS server is used to create secured HTTPS Web server and communicate with clients using secure HTTPS protocol. It allows to receive GET, POST, PUT, DELETE requests and send HTTP responses. 9 | /// 10 | /// Thread-safe. 11 | public class HttpsServer : SslServer 12 | { 13 | /// 14 | /// Initialize HTTPS server with a given IP address and port number 15 | /// 16 | /// SSL context 17 | /// IP address 18 | /// Port number 19 | public HttpsServer(SslContext context, IPAddress address, int port) : base(context, address, port) { Cache = new FileCache(); } 20 | /// 21 | /// Initialize HTTPS server with a given IP address and port number 22 | /// 23 | /// SSL context 24 | /// IP address 25 | /// Port number 26 | public HttpsServer(SslContext context, string address, int port) : base(context, address, port) { Cache = new FileCache(); } 27 | /// 28 | /// Initialize HTTPS server with a given DNS endpoint 29 | /// 30 | /// SSL context 31 | /// DNS endpoint 32 | public HttpsServer(SslContext context, DnsEndPoint endpoint) : base(context, endpoint) { Cache = new FileCache(); } 33 | /// 34 | /// Initialize HTTPS server with a given IP endpoint 35 | /// 36 | /// SSL context 37 | /// IP endpoint 38 | public HttpsServer(SslContext context, IPEndPoint endpoint) : base(context, endpoint) { Cache = new FileCache(); } 39 | 40 | /// 41 | /// Get the static content cache 42 | /// 43 | public FileCache Cache { get; } 44 | 45 | /// 46 | /// Add static content cache 47 | /// 48 | /// Static content path 49 | /// Cache prefix (default is "/") 50 | /// Cache filter (default is "*.*") 51 | /// Refresh cache timeout (default is 1 hour) 52 | public void AddStaticContent(string path, string prefix = "/", string filter = "*.*", TimeSpan? timeout = null) 53 | { 54 | timeout ??= TimeSpan.FromHours(1); 55 | 56 | bool Handler(FileCache cache, string key, byte[] value, TimeSpan timespan) 57 | { 58 | var response = new HttpResponse(); 59 | response.SetBegin(200); 60 | response.SetContentType(Path.GetExtension(key)); 61 | response.SetHeader("Cache-Control", $"max-age={timespan.Seconds}"); 62 | response.SetBody(value); 63 | return cache.Add(key, response.Cache.Data, timespan); 64 | } 65 | 66 | Cache.InsertPath(path, prefix, filter, timeout.Value, Handler); 67 | } 68 | /// 69 | /// Remove static content cache 70 | /// 71 | /// Static content path 72 | public void RemoveStaticContent(string path) { Cache.RemovePath(path); } 73 | /// 74 | /// Clear static content cache 75 | /// 76 | public void ClearStaticContent() { Cache.Clear(); } 77 | 78 | protected override SslSession CreateSession() { return new HttpsSession(this); } 79 | 80 | #region IDisposable implementation 81 | 82 | // Disposed flag. 83 | private bool _disposed; 84 | 85 | protected override void Dispose(bool disposingManagedResources) 86 | { 87 | if (!_disposed) 88 | { 89 | if (disposingManagedResources) 90 | { 91 | // Dispose managed resources here... 92 | Cache.Dispose(); 93 | } 94 | 95 | // Dispose unmanaged resources here... 96 | 97 | // Set large fields to null here... 98 | 99 | // Mark as disposed. 100 | _disposed = true; 101 | } 102 | 103 | // Call Dispose in the base class. 104 | base.Dispose(disposingManagedResources); 105 | } 106 | 107 | // The derived class does not have a Finalize method 108 | // or a Dispose method without parameters because it inherits 109 | // them from the base class. 110 | 111 | #endregion 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /source/NetCoreServer/IWebSocket.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Sockets; 2 | 3 | namespace NetCoreServer 4 | { 5 | /// 6 | /// WebSocket interface 7 | /// 8 | public interface IWebSocket 9 | { 10 | /// 11 | /// Handle WebSocket client connecting notification 12 | /// 13 | /// Notification is called when WebSocket client is connecting to the server. You can handle the connection and change WebSocket upgrade HTTP request by providing your own headers. 14 | /// WebSocket upgrade HTTP request 15 | void OnWsConnecting(HttpRequest request) {} 16 | /// 17 | /// Handle WebSocket client connected notification 18 | /// 19 | /// WebSocket upgrade HTTP response 20 | void OnWsConnected(HttpResponse response) {} 21 | 22 | /// 23 | /// Handle WebSocket server session validating notification 24 | /// 25 | /// Notification is called when WebSocket client is connecting to the server. You can handle the connection and validate WebSocket upgrade HTTP request. 26 | /// WebSocket upgrade HTTP request 27 | /// WebSocket upgrade HTTP response 28 | /// return 'true' if the WebSocket update request is valid, 'false' if the WebSocket update request is not valid 29 | bool OnWsConnecting(HttpRequest request, HttpResponse response) { return true; } 30 | /// 31 | /// Handle WebSocket server session connected notification 32 | /// 33 | /// WebSocket upgrade HTTP request 34 | void OnWsConnected(HttpRequest request) {} 35 | 36 | /// 37 | /// Handle WebSocket client disconnecting notification 38 | /// 39 | void OnWsDisconnecting() {} 40 | /// 41 | /// Handle WebSocket client disconnected notification 42 | /// 43 | void OnWsDisconnected() {} 44 | 45 | /// 46 | /// Handle WebSocket received notification 47 | /// 48 | /// Received buffer 49 | /// Received buffer offset 50 | /// Received buffer size 51 | void OnWsReceived(byte[] buffer, long offset, long size) {} 52 | 53 | /// 54 | /// Handle WebSocket client close notification 55 | /// 56 | /// Received buffer 57 | /// Received buffer offset 58 | /// Received buffer size 59 | /// WebSocket close status (default is 1000) 60 | void OnWsClose(byte[] buffer, long offset, long size, int status = 1000) {} 61 | 62 | /// 63 | /// Handle WebSocket ping notification 64 | /// 65 | /// Received buffer 66 | /// Received buffer offset 67 | /// Received buffer size 68 | void OnWsPing(byte[] buffer, long offset, long size) {} 69 | 70 | /// 71 | /// Handle WebSocket pong notification 72 | /// 73 | /// Received buffer 74 | /// Received buffer offset 75 | /// Received buffer size 76 | void OnWsPong(byte[] buffer, long offset, long size) {} 77 | 78 | /// 79 | /// Handle WebSocket error notification 80 | /// 81 | /// Error message 82 | void OnWsError(string error) {} 83 | 84 | /// 85 | /// Handle socket error notification 86 | /// 87 | /// Socket error 88 | void OnWsError(SocketError error) {} 89 | 90 | /// 91 | /// Send WebSocket server upgrade response 92 | /// 93 | /// WebSocket upgrade HTTP response 94 | void SendUpgrade(HttpResponse response) {} 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /source/NetCoreServer/NetCoreServer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | 8.0.7.0 6 | Ivan Shynkarenka 7 | Copyright (c) 2019-2023 Ivan Shynkarenka 8 | https://github.com/chronoxor/NetCoreServer 9 | Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution 10 | MIT 11 | https://github.com/chronoxor/NetCoreServer 12 | async;client;server;tcp;udp;ssl;tls;http;https;websocket;low latency;performance 13 | 14 | 15 | 16 | true 17 | snupkg 18 | True 19 | 1591 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /source/NetCoreServer/SslContext.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Security; 2 | using System.Security.Authentication; 3 | using System.Security.Cryptography.X509Certificates; 4 | 5 | namespace NetCoreServer 6 | { 7 | /// 8 | /// SSL context 9 | /// 10 | public class SslContext 11 | { 12 | /// 13 | /// Initialize SSL context with default protocols 14 | /// 15 | public SslContext() : this(SslProtocols.Tls13) {} 16 | /// 17 | /// Initialize SSL context with given protocols 18 | /// 19 | /// SSL protocols 20 | public SslContext(SslProtocols protocols) { Protocols = protocols; } 21 | /// 22 | /// Initialize SSL context with given protocols and validation callback 23 | /// 24 | /// SSL protocols 25 | /// SSL certificate 26 | public SslContext(SslProtocols protocols, RemoteCertificateValidationCallback certificateValidationCallback) 27 | { 28 | Protocols = protocols; 29 | CertificateValidationCallback = certificateValidationCallback; 30 | } 31 | /// 32 | /// Initialize SSL context with given protocols and certificate 33 | /// 34 | /// SSL protocols 35 | /// SSL certificate 36 | public SslContext(SslProtocols protocols, X509Certificate certificate) : this(protocols, certificate, null) {} 37 | /// 38 | /// Initialize SSL context with given protocols, certificate and validation callback 39 | /// 40 | /// SSL protocols 41 | /// SSL certificate 42 | /// SSL certificate 43 | public SslContext(SslProtocols protocols, X509Certificate certificate, RemoteCertificateValidationCallback certificateValidationCallback) 44 | { 45 | Protocols = protocols; 46 | Certificate = certificate; 47 | CertificateValidationCallback = certificateValidationCallback; 48 | } 49 | /// 50 | /// Initialize SSL context with given protocols and certificates collection 51 | /// 52 | /// SSL protocols 53 | /// SSL certificates collection 54 | public SslContext(SslProtocols protocols, X509Certificate2Collection certificates) : this(protocols, certificates, null) {} 55 | /// 56 | /// Initialize SSL context with given protocols, certificates collection and validation callback 57 | /// 58 | /// SSL protocols 59 | /// SSL certificates collection 60 | /// SSL certificate 61 | public SslContext(SslProtocols protocols, X509Certificate2Collection certificates, RemoteCertificateValidationCallback certificateValidationCallback) 62 | { 63 | Protocols = protocols; 64 | Certificates = certificates; 65 | CertificateValidationCallback = certificateValidationCallback; 66 | } 67 | 68 | /// 69 | /// SSL protocols 70 | /// 71 | public SslProtocols Protocols { get; set; } 72 | /// 73 | /// SSL certificate 74 | /// 75 | public X509Certificate Certificate { get; set; } 76 | /// 77 | /// SSL certificates collection 78 | /// 79 | public X509Certificate2Collection Certificates { get; set; } 80 | /// 81 | /// SSL certificate validation callback 82 | /// 83 | public RemoteCertificateValidationCallback CertificateValidationCallback { get; set; } 84 | 85 | /// 86 | /// Is the client is asked for a certificate for authentication. 87 | /// Note that this is only a request - if no certificate is provided, the server still accepts the connection request. 88 | /// 89 | public bool ClientCertificateRequired { get; set; } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /source/NetCoreServer/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace NetCoreServer 5 | { 6 | /// 7 | /// String extensions utility class. 8 | /// 9 | public static class StringExtensions 10 | { 11 | public static string RemoveSuffix(this string self, char toRemove) => string.IsNullOrEmpty(self) ? self : (self.EndsWith(toRemove) ? self.Substring(0, self.Length - 1) : self); 12 | public static string RemoveSuffix(this string self, string toRemove) => string.IsNullOrEmpty(self) ? self : (self.EndsWith(toRemove) ? self.Substring(0, self.Length - toRemove.Length) : self); 13 | public static string RemoveWhiteSpace(this string self) => string.IsNullOrEmpty(self) ? self : new string(self.Where(c => !Char.IsWhiteSpace(c)).ToArray()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | false 6 | xUnit1031 7 | 8 | 9 | 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | PreserveNewest 26 | 27 | 28 | PreserveNewest 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tools/certificates/ca-secret.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIJJwIBAAKCAgEAsJ3ML7gQGdfV0VqV/unEm1DHktyVOPBrZDenb8Z0ZUQJWI17 3 | spGN0SS4O2piNK6r1Jfe/oiSzoCLzMSMct/GlywZXDiE7O5BY2cnU2VXL7iMmmet 4 | MDlk1bSMt/3sUQRNXqAS0uXinEqiklLt159uFMcJRbW2bWNYTWBh/U+bU8RR37LH 5 | foBHFHgikKb+8cXxAq7m81gMijpbRUGW+IfR66AHJcLW9Jk9cYbWgFP41iEFPxIJ 6 | ETpOYnd+ZDpSWTBDCtlesgoUGDjrBzK5unHGMz9mB1OT5gQAUqcMYxf5+ySBVuVE 7 | AZ4xBmLlEswi39/qCQrhMKse82/DHtMsfaoKzVbuU+MMfr5T8nolpLN3Xg2iEkBc 8 | vJj+VIVFydvrbnSOzhxSJj9uXdWXMUOi8TdbzcjOAOgCFFq68qOUdHW6sMbPlzbB 9 | e/I8RbXo4UsXl58vhv3Hav6c/f9avOKzMIen96mpyBKXFemcFcQnwM4AblKuy0xi 10 | e+frIih8CuQhwh3O/jmVhBLVZecK6DdSGBjneTZ2z0CEDZJvuF/gs91oxMyu8jzc 11 | 5XHZ6cWTomqL9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3GPWwSESVeS 43 | Yv4f0rEU65gCdyvnn2w0z+1Sg/RKL8rFY2sOtssI6YT+oGsBlko4NbzqRVSYq9Ur 44 | DjtHrthjNpeqsjA0tuV0x69rc/KymwMChnViu2hpdAsxASDdWPw+oAD0hwV4irdf 45 | AGsd1U+IOTdSEiz3SVc20RwYtd7kVTECggEAHWLYo/djtnMExdJDzzBL3/DqZTOo 46 | U44Z5+kuuooI+2XM8b96zIPSZCyywE+yzYaTuglQCelDfRuFHOhmMIwqSfKkdrqy 47 | 2ywFfLZv8APvOJLVIqlCRinUwcAxgsFv5C5f4U+7rs7cblALE+g/VXQBvkcUsDLr 48 | RyIdQHKMaZ7alsO4U3vYAjvBQoKP7aCu1bwNb4EqZtrT9N+OzcASiOtUpAHTruuh 49 | IB/99GbOUZYTWJ9zZR9+yBfUzgKUmxe3LXU9xpKQC7cX2LVPHHSjefXimW9824Nn 50 | cQcy4VYKjeBvO4ZubG4NevBTDUCql4mV3AFkbJEkdbHgA5B3OFAxk4ECZg== 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /tools/certificates/ca.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIF0zCCA7ugAwIBAgIUVHt5rwzXTJ9E0k2ymFaSL3g3vrkwDQYJKoZIhvcNAQEL 3 | BQAweTELMAkGA1UEBhMCQlkxEDAOBgNVBAgMB0JlbGFydXMxDjAMBgNVBAcMBU1p 4 | bnNrMRgwFgYDVQQKDA9FeGFtcGxlIHJvb3QgQ0ExGDAWBgNVBAsMD0V4YW1wbGUg 5 | Q0EgdW5pdDEUMBIGA1UEAwwLZXhhbXBsZS5jb20wHhcNMTkwNjAxMTI1MjQzWhcN 6 | MjkwNTI5MTI1MjQzWjB5MQswCQYDVQQGEwJCWTEQMA4GA1UECAwHQmVsYXJ1czEO 7 | MAwGA1UEBwwFTWluc2sxGDAWBgNVBAoMD0V4YW1wbGUgcm9vdCBDQTEYMBYGA1UE 8 | CwwP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V84hqbBO4sGIRN5Jjkc 24 | cLeCBsHC2HvrI6RfiKIqt1tHTsjKvVQlV4em0ujTx2oSuDbAWUxCJgj8JE5lcR+8 25 | xPrqvCDqKcn9su1cQzpn2PaqApK8G4Wf5n7awWTYxmR174w2jFZt39f2y07vION/ 26 | nSrlKn5Z7capzvQdRXEreupFlYe9cgJOoCnkzBA6LrcdpF5mnPmkUhyn+8hA0nxU 27 | kOJ8kzlLPNdm/6Gl9IPY1qF66+Yx8v5DEwy6Ah9TYj0itWE9LVe5M4GTZEsoxmjt 28 | 9HC96xqkfZyk7eHoibZwIVMWw44toUj0PVUz4db9Ot5aYe5Zr9beBHO1STEeTutK 29 | Z4M9GJ3LekmfStO9VSe8VoLePRICF2uoLthaS6qGfr4duzwneqDRwjpHmJX4YNa7 30 | svf6g9a/YSA6UGISHCjXPP9kJOfb6raNkcurNiVhXzGNpXD5pO5oSAnCE9tF6gpv 31 | bwAqhIJGyo9zxMeQHC2F7dDmqa/seFYamtRdn2JkV6vXBTkQmcdmvpBsKzlqg6L+ 32 | 9vS1ig7ZLwIdeuoD7blMOZH9IIF0eHxJgykxP/i+EzSR8gfDC2iEDgOzIKipa5Ts 33 | NC3uMWWz3A== 34 | -----END CERTIFICATE----- 35 | -------------------------------------------------------------------------------- /tools/certificates/ca.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIJJwIBAAKCAgEAsJ3ML7gQGdfV0VqV/unEm1DHktyVOPBrZDenb8Z0ZUQJWI17 3 | spGN0SS4O2piNK6r1Jfe/oiSzoCLzMSMct/GlywZXDiE7O5BY2cnU2VXL7iMmmet 4 | MDlk1bSMt/3sUQRNXqAS0uXinEqiklLt159uFMcJRbW2bWNYTWBh/U+bU8RR37LH 5 | foBHFHgikKb+8cXxAq7m81gMijpbRUGW+IfR66AHJcLW9Jk9cYbWgFP41iEFPxIJ 6 | ETpOYnd+ZDpSWTBDCtlesgoUGDjrBzK5unHGMz9mB1OT5gQAUqcM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mNWRTjQ9Oz0I8CJX+5+srVJU79W35aVgH6i 39 | 2rzDZoiI/k5ozAlFKouwHeGacdZ7M3oX0Umc7sw4FzImnMDRzmAqf9a4TH05rSUD 40 | WfeBAoIBAA97zgAkeaHhbOk/iIJIUZJMlou5vcCvOOwkulQNLY2FewtgPViPDqTt 41 | j2gP4bBheQ/oMdYwT2lRe3LPwPUAoHKUCN4sv6Gy89lXZFC7cl42x4tux3pbSd3c 42 | bwWN5H0wAKt6q2Z4gWpo+gs9JtUVh2GPUNGm7p0hXjf4SbbVtZz3q3GPWwSESVeS 43 | Yv4f0rEU65gCdyvnn2w0z+1Sg/RKL8rFY2sOtssI6YT+oGsBlko4NbzqRVSYq9Ur 44 | DjtHrthjNpeqsjA0tuV0x69rc/KymwMChnViu2hpdAsxASDdWPw+oAD0hwV4irdf 45 | AGsd1U+IOTdSEiz3SVc20RwYtd7kVTECggEAHWLYo/djtnMExdJDzzBL3/DqZTOo 46 | U44Z5+kuuooI+2XM8b96zIPSZCyywE+yzYaTuglQCelDfRuFHOhmMIwqSfKkdrqy 47 | 2ywFfLZv8APvOJLVIqlCRinUwcAxgsFv5C5f4U+7rs7cblALE+g/VXQBvkcUsDLr 48 | RyIdQHKMaZ7alsO4U3vYAjvBQoKP7aCu1bwNb4EqZtrT9N+OzcASiOtUpAHTruuh 49 | IB/99GbOUZYTWJ9zZR9+yBfUzgKUmxe3LXU9xpKQC7cX2LVPHHSjefXimW9824Nn 50 | cQcy4VYKjeBvO4ZubG4NevBTDUCql4mV3AFkbJEkdbHgA5B3OFAxk4ECZg== 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /tools/certificates/ca.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/tools/certificates/ca.pfx -------------------------------------------------------------------------------- /tools/certificates/client-secret.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIJ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2g6fsIf4zGodwxzo+mxQAC0+ikgmLGL+XGkDtb+9ur 50 | fFZIACGhB8aba2yIKMUkjn72QvpaX1KRsh3MKH1ZDdDmOSVY9UE0c/GKpItbjaA= 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /tools/certificates/client.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFcTCCA1kCAQEwDQYJKoZIhvcNAQELBQAweTELMAkGA1UEBhMCQlkxEDAOBgNV 3 | BAgMB0JlbGFydXMxDjAMBgNVBAcMBU1pbnNrMRgwFgYDVQQKDA9FeGFtcGxlIHJv 4 | b3QgQ0ExGDAWBgNVBAsMD0V4YW1wbGUgQ0EgdW5pdDEUMBIGA1UEAwwLZXhhbXBs 5 | ZS5jb20wHhcNMTkwNjAxMTI1MjQ1WhcNMjkwNTI5MTI1MjQ1WjCBgzELMAkGA1UE 6 | BhMCQlkxEDAOBgNVBAgMB0JlbGFydXMxDjAMBgNVBAcMBU1pbnNrMRcwFQYDVQQK 7 | DA5FeGFtcGxlIGNsaWVudDEcMBoGA1UECwwTRXhhbXBsZSBjbGllbnQgdW5pdDEb 8 | MBkGA1UEAwwSY2xpZW50LmV4YW1wbGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOC 9 | Ag8AMIICCgKCAgEAyG7fNpmwFMip2daVMWleNfQ4djHJpAD3CY4PFL+CDU3MRwve 10 | QWyX04iOpInhRk8pTsPisWCqouBxmo14jprAOv5XVEm4eHTcvxQ1UsUBPSzF3h1o 11 | Uy2PuOnd803N1ja239z2jAMbdNwnihz9SoNT9i5wD3rDUK3vbUx1i8ixC/wX0RMI 12 | Vb1RtE+dCbyhsiXTesotB2uqzd4cDl0gLBmD9+lOlPKA5Qx3bzFJAjr7YlPEBL7J 13 | CL+bj+fC2lX7Hbn3tj3fPtgHjuglIL26WM8K8OYDdM2fq2X0XfPTcJasqxxs3+Bw 14 | 5P/7hXRx+Su2gEaNa0TlAwa+PL28TKmG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ef30Nfj3/oHdbw7aj3O1xj/4y6HfT1cLV/A1t9LJ7kO134rHao2NRuvughr 31 | 5kfERrg= 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /tools/certificates/client.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIEyTCCArECAQAwgYMxCzAJBgNVBAYTAkJZMRAwDgYDVQQIDAdCZWxhcnVzMQ4w 3 | DAYDVQQHDAVNaW5zazEXMBUGA1UECgwORXhhbXBsZSBjbGllbnQxHDAaBgNVBAsM 4 | E0V4YW1wbGUgY2xpZW50IHVuaXQxGzAZBgNVBAMMEmNsaWVudC5leGFtcGxlLmNv 5 | bTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMhu3zaZsBTIqdnWlTFp 6 | XjX0OHYxyaQA9wmODxS/gg1NzEcL3kFsl9OIjqSJ4UZPKU7D4rFgqqLgcZqNeI6a 7 | wDr+V1RJuHh03L8UNVLFAT0sxd4daFMtj7jp3fNNzdY2tt/c9owDG3TcJ4oc/UqD 8 | U/YucA96w1Ct721MdYvIsQv8F9ETCFW9UbRPnQm8obIl03rKLQdrqs3eHA5dICwZ 9 | g/fpTpTygOUMd28xSQI6+2JTxAS+yQi/m4/nwtpV+x2597Y93z7YB47oJSC9uljP 10 | CvDmA3TNn6tl9F3z03CWrKscbN/gcOT/+4V0cfkrtoBGjWtE5QMGvjy9vEyphmKa 11 | T+phChvez/30eOVMNTb+0jRVz/GsEN0+tdFYi5vpK49wLBO4a+ScEQj23nULx5tp 12 | q0PqJ7+l7ZvDw827qqQB5bVEFgZp3HXAch+NroHhkJmo8DP+IWVT6T4ZO/uuxxQl 13 | Df0LNR19ipySfTPvrDLeS3up5PW1aGEqCl8JpQz7wYk+N4HC/nJJPkI266SeoWRU 14 | XTwCCc4xUr7BWwIuUGsWpuidzlok6t8A6jvxpzxbRb7ZqVHPYhMUQcu+9rvJjW9g 15 | ZxDw9qw58NG08blh5FiKOokJY5fM/j8S1rTMsQW3EKWuOia0uk3HcdlqRkjhjnQq 16 | ZkPjtqntgeLtvvxkSUz+W8EPAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAgEAcBC/ 17 | 68GhRRHZ3LE1/ik8Y9FoHsIW02gmVSNXbjCWxhklXR+t8fq9Oc7IhaKGTAXYGH/D 18 | PGpGMSpzsdPKilvPRm/IrOJ93rMtfWtQ+x9ksTsgZw72GlNB9ccryjqZIRCK/1Up 19 | Pyi28TFrb085kP6mrIqk5dQpL7Zpi1XYe6Nh6r/IrLllyNi7noZhyKbBSp+urzTS 20 | WpI8K1p6/ivX3eZ5ZCAqca5kb9Qi7aXOUQ1OV7OZkOPTXtUMiMAzk1UC4Bvsg9MR 21 | S0jTiUIktTFZSRfBPZ/S/ZHsTg7iPtgTmKAGbZSBiMsuWbqafdI5NDa8wzSOrLTB 22 | uoD723L+t1Z57Trv69nkJQmqJTwz3mDDdSoEF6rUMywYZsAJBS8HH0ckrvrFZN88 23 | afV3FEeIDAKtZuGJS4rPxSzDWrnguqK76ocXOdDm5ILgWAX5Lhwog4UattKpAm8y 24 | HiWO6M1Q8/UsleZSKLHLs5VMFSg1854W9Gxdx/nVfnKOAlg/ldd1g5yY/H+rHjBl 25 | QXgwcLsBrQ3xZ+1beJi2AWhPcpr3MlguLocX3VXIxiY5pK4O9bscN+BuNVFTeZbV 26 | paoTsnad2wZKpQcJEsC+q2lwrbCuzP63aw1mn3Rhfa1XLYRR87Fu4V4DIzLRexwS 27 | mqvlo9Lf+E/y/TxryhOqcb0VZJHFJ2vhxqABSQI= 28 | -----END CERTIFICATE REQUEST----- 29 | -------------------------------------------------------------------------------- /tools/certificates/client.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIJKwIBAAKCAgEAyG7fNpmwFMip2daVMWleNfQ4djHJpAD3CY4PFL+CDU3MRwve 3 | QWyX04iOpInhRk8pTsPisWCqouBxmo14jprAOv5XVEm4eHTcvxQ1UsU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-----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /tools/certificates/client.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/tools/certificates/client.pfx -------------------------------------------------------------------------------- /tools/certificates/dh4096.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DH PARAMETERS----- 2 | MIICCAKCAgEA3vn3BRdZq7LQFwt94mhU6oZdPKSsrO4Iylb3FVEp4BY4JNGKAANc 3 | m1nFkCTSTLonQBNyDmfYPh1aHaXhl1J7QOGDMo+ydMNnsRDv72iuwJxb2RFC2pb7 4 | B1mbgkzHFW0xcMefIAnvYXxS5tcPV1zoxYAeo75YsJXb7NxBquW45py/0W3Tf8lB 5 | Ml60GjRSA9bnlS8hLDbz/Y0i2Fp01MH4Isq0EvaYn/BckBJpfMGDI67+cjeSfZY9 6 | +FV9po0qNVV8kl8D0oSWp1xBSigNuKb0x/XloW9zlrNClpHlFU46gbvlNA3E57w7 7 | B4OUTUHuMYVmVnxIAngJLTXAD9iii+Am979qiJbZMgwA1iGxtsPxS5/dyzYfFSp4 8 | dfQnMNvuxRzJyYtk8Q/pZZxNdDhlKlIPpF1UlXQwoO4ppOOCUndAIomzMyP2/Up4 9 | FlYd1Cgo9rg3FKyGBxbQtwS8JhthJrqjnhiI/eaSyzP9aNFl0YsTfCMeMOtfgWia 10 | BoD4BFvsuBZa+YFE0un2d7uSAHdCq7BCY2kNu+kD7jVp6bh9ZcZayWnZZy/1Gp1E 11 | ChvXuaFwfqwNBTde7HlR1mBg3LYHvG41yNgdAabSAudTdUVkrWQM9yjSdMFYciVe 12 | ncyqkwNnZhcMf/CeBFx3fJndJih25N8lIMhNkSXUQ507Idh5MUV1DbMCAQI= 13 | -----END DH PARAMETERS----- 14 | -------------------------------------------------------------------------------- /tools/certificates/generate.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/tools/certificates/generate.bat -------------------------------------------------------------------------------- /tools/certificates/generate.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/tools/certificates/generate.sh -------------------------------------------------------------------------------- /tools/certificates/server-secret.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIJJwIBAAKCAgEAtdVvGlBsP+78L+bpRgvPdti+AVgM1JCMP7mOHvv3m+x0gIp1 3 | j/Sg/S0h/leYsPu7H2k5xv41Y4fmWPX7u0xPLdI+/u1zHHc6IGEaM0aEddEruDUr 4 | QcQt+h62c/nIJ+tcXuSHrTZREbczZq4gm7exvAuvYd0B/lg2kXLQ9Y7eqShhKPtH 5 | B6a5YH2snJWJbk8E9WVwem37nrH5DJ99/q+hQHl9rdrP03KAEIbMLGgo3r2YuOoa 6 | 7qoywusyH9xMpWzDt0QhXxhfmWnSNyZG8ztfoXt6TDTZQ2HD/H/dZlt3skgJAWcU 7 | tlF4l0tZ55495SC4ozFyk84tNJPBD/QkRYmn3GfJ1zHgdFru+H2qYHJv5B4ssUbS 8 | cPkXwcsASci/JiyIbhPzOpbpCTUGX3OAMBKIFtxJNKmHeosftR9I97dNfJZCCiC7 9 | k5NL8GaTw0484tLqfuH1bOmUULsfLaEj6rsiXLz9uB8T16/K9pKf2LIB++eCEU71 10 | S4n6BHyiH09uL1KZ0msc5beggUiUglCUYy31aIFuZl/wCuH8GJZv0kepAWLIL23h 11 | PwpzS5o+tZHefwS//qG8mcy7a+NcLlIsLNPRVToYmlcNnfeAxcDqwRm2GKfAY4i7 12 | CUt4vgyEGbFxBNsh6ozTkd9tE3qkRtpMRKcX3ZQmYJNjEOl7XCnUk9SLMOECAwEA 13 | AQKCAgBb3rJ7wRZwVvbj3O8PjPgNPAUD+NDCtSWnLME5tmSsSxOxvkMXsKmGQT9j 14 | mi5zfTxV6nxepiGjYA5p9B5zy2JV7FwXwTDfuP2N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Y7uGnpUWzlfz7idUmCxVgTZ+qLwQGvebD+EVINiT3mWXl25nWWSDArMGMLtq 47 | UD9GB9RuY6xA3drK0mW0EMuUzU6Qxq3AYUEKhSXiRjipCD0fIZbq7hBMQ+a1Tj2P 48 | phVxgVMA+z1AEyQy1LogNuXy/0LfYoFisqQfwzwqlLYcd6jdsGrp53NM8GogRCSV 49 | x0vMddjjnZhbVnukmPWZfasuOstBy9PcB5uzvQzDLAv59Yho/RD4sqamPXQpbY3S 50 | aqhG8KD/fYudFbY0J06VESq2bL/ZpMMPK9MJgmcLVXcR/MBjoXUI24PzAg== 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /tools/certificates/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFcTCCA1kCAQEwDQYJKoZIhvcNAQELBQAweTELMAkGA1UEBhMCQlkxEDAOBgNV 3 | BAgMB0JlbGFydXMxDjAMBgNVBAcMBU1pbnNrMRgwFgYDVQQKDA9FeGFtcGxlIHJv 4 | b3QgQ0ExGDAWBgNVBAsMD0V4YW1wbGUgQ0EgdW5pdDEUMBIGA1UEAwwLZXhhbXBs 5 | ZS5jb20wHhcNMTkwNjAxMTI1MjQ0WhcNMjkwNTI5MTI1MjQ0WjCBgzELMAkGA1UE 6 | BhMCQlkxEDAOBgNVBAgMB0JlbGFydXMxDjAMBgNVBAcMBU1pbnNrMRcwFQYDVQQK 7 | DA5FeGFtcGxlIHNlcnZlcjEcMBoGA1UECwwTRXhhbXBsZSBzZXJ2ZXIgdW5pdDEb 8 | MBkGA1UEAwwSc2VydmVyLmV4YW1wbGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOC 9 | Ag8AMIICCgKCAgEAtdVvGlBsP+78L+bpRgvPdti+AVgM1JCMP7mOHvv3m+x0gIp1 10 | j/Sg/S0h/leYsPu7H2k5xv41Y4fmWPX7u0xPLdI+/u1zHHc6IGEaM0aEddEruDUr 11 | QcQt+h62c/nIJ+tcXu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| ARaPso0J9V3jXm44+qd4pHgnLr7SOp3B5Jf71yhN1p5fKYqPkbiCiZFxOXO3s5z6 28 | +4247z7ZCD7k9UMqKflj4eLQD+OnTJ6VFyrovTQnjCsbTsEmI1S8arvAEosAX5GU 29 | vR05YZnEO9rEzOSh9tBuuht8woK5tQpLQwksgOiQATcZCN/ioz1SmyrRIfwEBh66 30 | MB4SMwGjiaARsWhV+iEpS8mwvI1WtX/4Xgo7NropbFyIuJsZsmvDfuffqp9Z8f/b 31 | kYDiTio= 32 | -----END CERTIFICATE----- 33 | -------------------------------------------------------------------------------- /tools/certificates/server.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIEyTCCArECAQAwgYMxCzAJBgNVBAYTAkJZMRAwDgYDVQQIDAdCZWxhcnVzMQ4w 3 | DAYDVQQHDAVNaW5zazEXMBUGA1UECgwORXhhbXBsZSBzZXJ2ZXIxHDAaBgNVBAsM 4 | E0V4YW1wbGUgc2VydmVyIHVuaXQxGzAZBgNVBAMMEnNlcnZlci5leGFtcGxlLmNv 5 | bTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALXVbxpQbD/u/C/m6UYL 6 | z3bYvgFYDNSQjD+5jh7795vsdICKdY/0oP0tIf5XmLD7ux9pOcb+NWOH5lj1+7tM 7 | Ty3SPv7tcxx3OiBhGjNGhHXRK7g1K0HELfoetnP5yCfrXF7kh602URG3M2auIJu3 8 | sbwLr2HdAf5YNpFy0PWO3qkoYSj7RwemuWB9rJyViW5PBPVlcHpt+56x+Qyfff6v 9 | oUB5fa3az9NygBCGzCxoKN69mLjqGu6qMsLrMh/cTKVsw7dEIV8YX5lp0jcmRvM7 10 | X6F7ekw02UNhw/x/3WZbd7JICQFnFLZReJdLWeeePeUguKMxcpPOLTSTwQ/0JEWJ 11 | p9xnydcx4HRa7vh9qmByb+QeLLFG0nD5F8HLAEnIvyYsiG4T8zqW6Qk1Bl9zgDAS 12 | iBbcSTSph3qL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REQUEST----- 29 | -------------------------------------------------------------------------------- /tools/certificates/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIJJwIBAAKCAgEAtdVvGlBsP+78L+bpRgvPdti+AVgM1JCMP7mOHvv3m+x0gIp1 3 | j/Sg/S0h/leYsPu7H2k5xv41Y4fmWPX7u0xPLdI+/u1zHHc6IGEaM0aEddEruDUr 4 | QcQt+h62c/nIJ+tcXuSHrTZREbczZq4gm7exvAuvYd0B/lg2kXLQ9Y7eqShhKPtH 5 | B6a5YH2snJWJbk8E9WVwem37nrH5DJ99/q+hQHl9rdrP03KAEIbMLGgo3r2YuOoa 6 | 7qoywusyH9xMpWzDt0QhXxhfmWnSNyZG8ztfoXt6TDTZQ2HD/H/dZlt3skgJAWcU 7 | tlF4l0tZ55495SC4ozFyk84tNJPBD/QkRYmn3GfJ1zHgdFru+H2qYHJv5B4ssUbS 8 | cPkXwcsASci/JiyIbhPzOpbpCTUGX3OAMBKIFtxJNKmHeosftR9I97dNfJZCCiC7 9 | k5NL8GaTw0484tLqfuH1bOmUULsfLaEj6rsiXLz9uB8T16/K9pKf2LIB++eCEU71 10 | S4n6BHyiH09uL1KZ0msc5beggUiUglCUYy31aIFuZl/wCuH8GJZv0kepAWLIL23h 11 | PwpzS5o+tZHefwS//qG8mcy7a+NcLlIsLNPRVToYmlcNnfeAxcDqwRm2GKfAY4i7 12 | CUt4vgyEGbFxBNsh6ozTkd9tE3qkRtpMRKcX3ZQmYJNjEOl7XCnUk9SLMOECAwEA 13 | AQKCAgBb3rJ7wRZwVvbj3O8PjPgNPAUD+NDCtSWnLME5tmSsSxOxvkMXsKmGQT9j 14 | mi5zfTxV6nxepiGjYA5p9B5zy2JV7FwXwTDfuP2NToJGVeKnBD/qmjJ4z/3K2aml 15 | fxY51RieeShzw3XCVaWKw3+GLZGHSQAbmeZf84Heivw4lS66mMQ+SHbizsHqlpSX 16 | qJX/Pb1rnwztTpRK4fDLB+pIu8PlJ3zw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j2P 48 | phVxgVMA+z1AEyQy1LogNuXy/0LfYoFisqQfwzwqlLYcd6jdsGrp53NM8GogRCSV 49 | x0vMddjjnZhbVnukmPWZfasuOstBy9PcB5uzvQzDLAv59Yho/RD4sqamPXQpbY3S 50 | aqhG8KD/fYudFbY0J06VESq2bL/ZpMMPK9MJgmcLVXcR/MBjoXUI24PzAg== 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /tools/certificates/server.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/tools/certificates/server.pfx -------------------------------------------------------------------------------- /www/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /www/api/openapi.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.0 2 | 3 | info: 4 | version: 1.0 5 | title: HTTP Cache Server API 6 | description: HTTP Cache Server API 7 | contact: 8 | name: chronoxor 9 | url: https://github.com/chronoxor/CppServer 10 | email: chronoxor@gmail.com 11 | 12 | servers: 13 | - url: /api 14 | description: Cache API 15 | 16 | tags: 17 | - name: Cache 18 | description: Cache methods 19 | 20 | paths: 21 | /cache: 22 | get: 23 | tags: 24 | - Cache 25 | summary: Get the cache value 26 | operationId: GetCacheValue 27 | parameters: 28 | - name: key 29 | in: query 30 | description: Cache key (optional) 31 | required: false 32 | schema: 33 | type: string 34 | example: 'test' 35 | responses: 36 | 200: 37 | description: Success 38 | content: 39 | application/json: 40 | schema: 41 | $ref: '#/components/schemas/CacheItems' 42 | text/plain: 43 | schema: 44 | type: string 45 | 404: 46 | description: Cache key not found 47 | content: {} 48 | 500: 49 | description: Internal server error 50 | content: {} 51 | post: 52 | tags: 53 | - Cache 54 | summary: Create the cache value 55 | operationId: CreateCacheValue 56 | parameters: 57 | - name: key 58 | in: query 59 | description: Cache key 60 | required: true 61 | schema: 62 | type: string 63 | example: 'test' 64 | requestBody: 65 | description: Cache value to create 66 | required: true 67 | content: 68 | text/plain: 69 | schema: 70 | type: string 71 | example: 'value' 72 | responses: 73 | 200: 74 | description: Success 75 | content: {} 76 | 500: 77 | description: Internal server error 78 | content: {} 79 | put: 80 | tags: 81 | - Cache 82 | summary: Modify the cache value 83 | operationId: ModifyCacheValue 84 | parameters: 85 | - name: key 86 | in: query 87 | description: Cache key 88 | required: true 89 | schema: 90 | type: string 91 | example: 'test' 92 | requestBody: 93 | description: Cache value to modify 94 | required: true 95 | content: 96 | text/plain: 97 | schema: 98 | type: string 99 | example: 'modified' 100 | responses: 101 | 200: 102 | description: Success 103 | content: {} 104 | 500: 105 | description: Internal server error 106 | content: {} 107 | delete: 108 | tags: 109 | - Cache 110 | summary: Delete the cache value 111 | operationId: DeleteCacheValue 112 | parameters: 113 | - name: key 114 | in: query 115 | description: Cache key 116 | required: true 117 | schema: 118 | type: string 119 | example: 'test' 120 | responses: 121 | 200: 122 | description: Success 123 | content: 124 | text/plain: 125 | schema: 126 | type: string 127 | 404: 128 | description: Cache key not found 129 | content: {} 130 | 500: 131 | description: Internal server error 132 | content: {} 133 | head: 134 | tags: 135 | - Cache 136 | summary: Get the cache headers 137 | operationId: GetCacheHeaders 138 | responses: 139 | 200: 140 | description: Success 141 | content: {} 142 | 500: 143 | description: Internal server error 144 | content: {} 145 | options: 146 | tags: 147 | - Cache 148 | summary: Get the cache options 149 | operationId: GetCacheOptions 150 | responses: 151 | 200: 152 | description: Success 153 | content: {} 154 | 500: 155 | description: Internal server error 156 | content: {} 157 | 158 | components: 159 | schemas: 160 | CacheItem: 161 | type: object 162 | properties: 163 | key: 164 | type: string 165 | value: 166 | type: string 167 | CacheItems: 168 | type: array 169 | items: 170 | $ref: '#/components/schemas/CacheItem' 171 | -------------------------------------------------------------------------------- /www/api/swagger.js: -------------------------------------------------------------------------------- 1 | window.onload = function() { 2 | // 3 | 4 | // the following lines will be replaced by docker/configurator, when it runs in a docker-container 5 | window.ui = SwaggerUIBundle({ 6 | url: "openapi.yaml", 7 | defaultModelsExpandDepth: 0, 8 | displayRequestDuration: true, 9 | dom_id: '#swagger-ui', 10 | deepLinking: true, 11 | presets: [ 12 | SwaggerUIBundle.presets.apis, 13 | SwaggerUIStandalonePreset 14 | ], 15 | plugins: [ 16 | SwaggerUIBundle.plugins.DownloadUrl 17 | ], 18 | layout: "StandaloneLayout" 19 | }); 20 | 21 | // 22 | }; 23 | -------------------------------------------------------------------------------- /www/api/swagger/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/www/api/swagger/favicon-16x16.png -------------------------------------------------------------------------------- /www/api/swagger/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/www/api/swagger/favicon-32x32.png -------------------------------------------------------------------------------- /www/api/swagger/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | box-sizing: border-box; 3 | overflow: -moz-scrollbars-vertical; 4 | overflow-y: scroll; 5 | } 6 | 7 | *, 8 | *:before, 9 | *:after { 10 | box-sizing: inherit; 11 | } 12 | 13 | body { 14 | margin: 0; 15 | background: #fafafa; 16 | } 17 | -------------------------------------------------------------------------------- /www/api/swagger/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /www/api/swagger/oauth2-redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Swagger UI: OAuth2 Redirect 5 | 6 | 7 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /www/api/swagger/swagger-initializer.js: -------------------------------------------------------------------------------- 1 | window.onload = function() { 2 | // 3 | 4 | // the following lines will be replaced by docker/configurator, when it runs in a docker-container 5 | window.ui = SwaggerUIBundle({ 6 | url: "https://petstore.swagger.io/v2/swagger.json", 7 | dom_id: '#swagger-ui', 8 | deepLinking: true, 9 | presets: [ 10 | SwaggerUIBundle.presets.apis, 11 | SwaggerUIStandalonePreset 12 | ], 13 | plugins: [ 14 | SwaggerUIBundle.plugins.DownloadUrl 15 | ], 16 | layout: "StandaloneLayout" 17 | }); 18 | 19 | // 20 | }; 21 | -------------------------------------------------------------------------------- /www/ws/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/www/ws/favicon.png -------------------------------------------------------------------------------- /www/ws/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WebSocket chat client example 6 | 7 | 8 | 9 | 86 |
87 |

88 | 89 |

90 |

91 | 92 | 93 |

94 |

95 | 96 |

97 |

98 | 99 |

100 |

101 | 102 | 103 |

104 |
105 | 106 | 107 | -------------------------------------------------------------------------------- /www/wss/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronoxor/NetCoreServer/51d182341f3234367a5ef440ffb72d393a8a5f81/www/wss/favicon.png -------------------------------------------------------------------------------- /www/wss/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WebSocket chat client example 6 | 7 | 8 | 9 | 86 |
87 |

88 | 89 |

90 |

91 | 92 | 93 |

94 |

95 | 96 |

97 |

98 | 99 |

100 |

101 | 102 | 103 |

104 |
105 | 106 | 107 | --------------------------------------------------------------------------------