// See https://aka.ms/new-console-template for more information namespace Net; internal class Program { public const string rootCPath = "E:\\zRoot\\C"; public static void Main(string[] args) { Console.WriteLine("Hello, World!"); Console.WriteLine("key: Q is Server, key: W is Client!"); Server server = null; Client client = null; ConsoleKey key; while (true) { key = Console.ReadKey().Key; if (key == ConsoleKey.W) { client = new Client("127.0.0.1:7789"); } if (key == ConsoleKey.Q) { server = new Server(); } if (key == ConsoleKey.S && client != null) { DirectoryInfo directoryInfo = new DirectoryInfo(rootCPath); FileInfo[] fileInfos = directoryInfo.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { client.SendFile(fileInfo.FullName, HHH); } } if (key == ConsoleKey.Escape) { //zClient.CloseAsync().Forget(); break; } Thread.Sleep(100); } Console.WriteLine("断开链接"); Console.ReadLine(); } private static void HHH(string obj) { Console.WriteLine($"woccccccccc {obj}"); } }