问题描述
大家好,
我想对架构和实施提出疑问:
I want to have a question regarding to an architecture and implementation:
例如,我有这个类图:
SocketComm(1)---有----->(1)FirstParser - 有----> (n)单元
SocketComm (1)--- has ----->(1) FirstParser -- has ----> (n) Unit
- SocketComm:是接收数据的TCP / IP套接字服务器
- SocketComm: is a TCP/IP socket server receiving data
- FirstParser:检查此套接字数据属于哪个单位
- FirstParser: is to check this socket data is belonged to which unit
- 单位:解析数据
- Units: parsing data
===函数===
在SocketComm中:是一个TCP / IP套接字服务器接收数据并将它们放在FirstParser中的FirstParser.Queue.Add(Newdata)
in SocketComm: is a TCP/IP socket server receiving data and put them in a list FirstParser.Queue.Add(Newdata)
列表中:是一个每1毫秒检查一次的计时器以检查是否存在队列中的任何项目。如果是,那么检查哪个新数据属于哪个单位
in FirstParser: is a timer which ticks every 1 millisecond to check is there any item in the queue. If yes, then check which newdata is belonged to which unit
单位:是一个计时器,每1毫秒计时一次,以开始与设备的通信
in Unit: is a timer which ticks every 1 millisecond to start its communication with the device
因此,FirstParser中有一个计时器,Unit类中有多个计时器。
So there is one timer in FirstParser and multiple timers in Unit class.
有人请给我一些建议吗?这个架构以及使用多个计时器来实现的方式?
Would anybody please give me some advices about this architecture and also the way of using number of timers for implementing?
提前谢谢。
Thanks in advance.
推荐答案
希望这会有所帮助。
这篇关于解析数据通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!