static void Main(string[] args) { ConsoleKey key; ServerClient client = new ServerClient(); string filePath = Environment.CurrentDirectory + "/" + "1.jpg"; if (File.Exists(filePath)) { client.BeginSendFile(filePath); } Console.WriteLine("\n\n输入\"Q\"键退出。"); do { key = Console.ReadKey(true).Key; filePath = Environment.CurrentDirectory + "/" + "1.jpg"; if (File.Exists(filePath)) { client.BeginSendFile(filePath); } } while (key != ConsoleKey.Q); }
private static void OnIncomingData(ServerClient sc, string data) { //Broadcast(data, clients); Console.WriteLine(sc.clientName = " says: " + data); }