コード例 #1
0
        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);
        }
コード例 #2
0
 private static void OnIncomingData(ServerClient sc, string data)
 {
     //Broadcast(data, clients);
     Console.WriteLine(sc.clientName = " says: " + data);
 }