public async Task RunAsync() { ShowHelp(); _ = StartPingAll(); while (true) { var line = Console.ReadLine(); if (line == null) { await Quit(); break; } if (line.Length == 0) { continue; } if (line.StartsWith(":")) { if (await ParseCommand(line)) { continue; } else { break; } } await _dlc.Broadcast(BroadcastChannel, line); } }
public static async ValueTask Broadcast(this DataLinkCollection dlc, string group, string content) { var length = Encoding.UTF8.GetByteCount(content); using (var owner = ExactSizeMemoryPool.Shared.Rent(length)) { Encoding.UTF8.GetBytes(content, owner.Memory.Span); await dlc.Broadcast(group, owner.Memory); } }