コード例 #1
0
        public void setProtocol(TypeCommunication _typeCommunication)
        {
            this._typeCom = _typeCommunication;

            if (_typeCommunication.Equals(TypeCommunication.UDP))
            {
                Console.WriteLine("*******Type de communication : UDP -------> Création flux UDP ");
                Console.WriteLine();
                UDPFactory udpFactory = new UDPFactory();
                this.flow = udpFactory.CreateFlux();
            }

            if (_typeCommunication.Equals(TypeCommunication.TCP))
            {
                Console.WriteLine("*******Type de communication : TCP -------> Création flux TCP ");
                Console.WriteLine();
                TCPFactory tcpFactory = new TCPFactory();
                this.flow = tcpFactory.CreateFlux();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: stevenwjh/iSlide
 static void Main(string[] args)
 {
     try
     {
         string msg = "";
         while (true)
         {
             msg = UDPFactory.GetReceiver().ReceiveMessage();
             if (msg.IndexOf("exit") != -1)
             {
                 break;
             }
             Console.WriteLine(msg);
         }
     }
     catch (System.Exception ex)
     {
         Console.WriteLine("出错啦!" + ex.Message);
         Console.Write("按下回车键后退出");
         Console.ReadLine();
     }
 }