摘要
通常串口设备与主机间的通讯是一一对应的。而客户端与服务器间的通讯一般都是多线程并发的,因此在多客户端调用服务器端串口设备时就会产生矛盾。文中从软件的角度出发,探讨了用程序方式控制客户端请求,协调多客户端资源分配及数据传递的可能性。提出串口操作函数加锁、设置服务器端队列、握手协议二次开发和快速反应4种解决方案。最后分析了这4种方法在实际应用过程中各自的优缺点。
Usually, the communication type between server and serial- equipment is point- to- point. But the communication between client and server is multi - thread parallel rurming. So it arises contradictions when multi - clients want to use one serial - equipment on the server at the same time. Discusses the poesibility of using program to control the client's requests and corresponding the resouree distribution and data transfer between one client and another from the software side. And brings forward four solutions: locking for the serial operating function, set queue on the server, the second developing to the handshake protocol and quickly response. And then analyses the advantages and disadvantages of each other in practical situation.
出处
《计算机技术与发展》
2006年第11期64-66,共3页
Computer Technology and Development
关键词
串口
加锁
队列
serial- port
lock
queue