摘要:
读取固定长度 private static byte[] ReadBytes(Stream stream, int count) { var output = new byte[count]; var total = 0; while (total < count) { var read = str 阅读全文
摘要:
using System.Security.Cryptography; using System.Text; namespace ConsoleApp7 { internal class Program { static void Main(string[] args) { var servers 阅读全文
摘要:
internal class Program { static int WriteDelay = 50; static int ReadDelay = 20; static async Task Main(string[] args) { /* pauseWriterThreshold: 当Pipe 阅读全文
摘要:
Server internal class Program { static async Task Main(string[] args) { var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 5000); var socket 阅读全文
摘要:
codepage就是各国的文字编码和Unicode之间的映射表。系统使用映射表就可以在各种编码中做转换。 查表 以gbk为例,它的codepage=936, 可以从ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.T 阅读全文
摘要:
private static Task WriteResponse(HttpContext context, HealthReport healthReport) { context.Response.ContentType = "application/json; charset=utf-8"; 阅读全文
摘要:
服务端 开启websocket中间件 // 需要UseWebSockets,否则无法使用WebSocket app.UseWebSockets(new WebSocketOptions() { KeepAliveInterval = TimeSpan.FromSeconds(60), }); // 阅读全文
摘要:
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; using M 阅读全文
摘要:
internal class Program { static async Task Main(string[] args) { var root = new Root { Demo1 = new Demo1 { Name = "Demo1", Data = new Demo2 { Name = " 阅读全文
摘要:
ConfigurationRoot public interface IConfiguration { string? this[string key] { get; } IChangeToken GetReloadToken(); } public interface IConfiguration 阅读全文