所以我有一台电脑通过串行电缆和以太网电缆连接到微 Controller 。最初,PC 通过串行电缆向微 Controller 发送一个字节。这会导致微 Controller 通过以太网电缆发回 UDP 数据报。
我想知道我的电脑上运行的代码应该是服务器还是客户端?
最佳答案
每个维基百科客户端/服务器:
The server component provides a function or service to one or many clients, which initiate requests for such services
和主/从:
Master/slave is a model of asymmetric communication or control where one device or process controls one or more other devices or processes and serves as their communication hub
上面的场景看起来像主/从。在最初的“空闲”情况下,没有“服务器”正在等待(“监听”)请求。只有当 PC 激活微 Controller 时,它们才会开始通信(通过 UDP)。
关于c - 在下面的场景中我是服务器还是客户端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59209711/