0

我需要一些帮助,我正处于客户端服务器软件的早期设计阶段,我不知道 2 个选项(Web 服务或套接字编程)中的哪一个适合我的软件。

所有编程都在python中。

布局: 在此处输入图像描述

  1. PC 将需要运行服务器服务 - 该服务器将从本地计算机获取命令并将它们发送到 MiniPC。

  2. MiniPC 将需要运行客户端服务 - 当它识别命令(方法)时,他将转到硬件(通过串行、usb 连接......),做一些事情并返回结果到 miniPC。

  3. MiniPC 获取硬件结果并将其发送到日志服务器和主 PC

笔记:

  • PC可以控制多台MiniPC。
  • 一次硬件响应的数据量可达 10Kb。
  • 从 PC 到 MiniPC 的命令很小(字符串)
  • 记录数据最大可达 10Kb。

问题:

  1. 您对协议 Web (http) 或 Socket 编程有什么建议?
  2. 您对设计有什么建议吗?
4

2 回答 2

0

I'have done a similar project with ARM-based controllers instead on BeagleBone : feel free to ask me questions by commentaries.

Firstly, technically your BeagleBones are servers - since they ran a daemon service which is event triggered - and PC are clients. (but it is just pendantry)

Secondly, due to the limitations of embedded devices, I was not able to have an efficient Web server running on servers, so the choice was simple. I would advise you to stick with socket programming, but adding network services such as DCHP , support of TCP/UDP/UDP multicast, ping, echo, ...

Finally, the important question in terms of performance is the following : what's the physical layer of communication ? Ethernet ? Wifi ? Bluetooth/ZigBee ? I2C/CAN/... ?

I will guess it's Ethernet : IEEE 802.11 protocol doesn't scale well because of CSMA ( see here http://fr.wikipedia.org/wiki/CSMA ). If you want to have several devices (dozens), you will need switches/routers to encapsulate sub-networks to avoid network congestion.

于 2013-08-29T08:43:53.077 回答
0

您应该能够为此使用套接字编程。在 PC 上设置套接字服务器,在 MiniPC 设备上设置客户端。客户端将等待来自 PC 的输入(从套接字读取),然后发回他们将从硬件返回的输出。在设计方面,我看到了两件事。首先,套接字服务器可以运行一个 select() 来处理多个客户端。其次,您可能希望将 MiniPC 套接字的 SO_SNDBUF 套接字选项和 PC 上服务器的 SO_RCVBUF 提高到 10Kb 的倍数。您考虑 Web 的理由是什么?

于 2013-08-29T08:33:11.823 回答