예제 #1
0
        static void Main(string[] args)
        {
            var driver = new MyDriver("jeffz://server:12345");

            try
            {
                driver.Connect();
                driver.AddQuery(1);
                driver.AddQuery(2);
                driver.AddQuery(3);
            }
            catch
            {
                driver.Close();
                Console.WriteLine("Error occurred when connect or add query.");
                Environment.Exit(1);
            }

            new Thread(() => ReceiveData(driver)).Start();
        }
예제 #2
0
 private static void ReceiveData(MyDriver driver)
 {
     try
     {
         while (true)
         {
             var data = driver.Receive();
             if (data == null)
             {
                 Console.WriteLine("Closed");
                 break;
             }
             else
             {
                 Console.WriteLine(data);
             }
         }
     }
     catch (MyDriverException)
     {
         driver.Close();
         Console.WriteLine("Error occurred when receive data.");
     }
 }