????????????????????????
???????????? ???????[ 2012/1/30 9:44:44 ] ????????
?????????????????????????????????????????????鼮???????濪???????????????????????????????磬?????о????????????????н?????????????????????????????????????е???????????ζ???????????????????????????????????????TDD??????????????????????????????????????????????????????????????????????о????????θ?????????????????????????????′????????????????????????????????????ɡ??????????Щ????????л??????????????
????MyDriver???????
???????????????????????????????C#??Java????????????????????????????λ??????????????????????Χ??C#????????????????Java?????C#??????????????????????£????Щ???????????????????
??????????????????MyDriver???????????????????????????????????????????????£???????????????????????????????????????????κδ??????????MyClient?????????????
????MyDriver????????????????MyDriverClient?????м???????????
?????? MyDriverClient(string uri)?????????????????MyDriverClient??????????uri?????????????????????????衣
?????? void Connect()?????????????????????????к?????????
?????? void AddQuery(int queryId)??????????????????????????queryId????????queryId??ε??????????????????????
?????? void RemoveQuery(int queryId)??????????????????????????queryId??????????????????????????????κ????顣
?????? void Close()????????????????????
?????? MyData Receive()?????????????????????????????????????????????????????????????????null??
????????Connect??AddQuery??RemoveQuery??Receive???????????????????????????п???????MyDriverException????Щ?????????????????MyDriverClient?????????????????????????????????????Close???????????
????MyData????????Σ?int?????QueryID????????????Value??????????????????????????????Value?????????????????????????????????????????????????????????????????????RemoveQuery????????id?????????????????????????????????????????id?й?????????????????????Receive??????????????id?й??MyData??????????????????????????????????
?????????AddQuery??????????id???????????????????????????{ QueryID?? id?? Value?? "begin" }??????MyData???????????????Ч?????????????????????ò???????????
??????Program???????п???е?Main?????????????????????????Щ??????
static voidMain(string[] args)
{vardriver =newMyDriverClient("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);
}newThread(() => ReceiveData(driver)).Start();
}private static voidReceiveData(MyDriverClientdriver)
{try{while(true)
{vardata = driver.Receive();if(data ==null)
{Console.WriteLine("Closed");break;
}else{Console.WriteLine(data);
}
}
}catch(MyDriverException)
{
driver.Close();Console.WriteLine("Error occurred when receive data.");
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11