简体   繁体   English

在不同设备上进行程序间通信的最简洁方法

[英]Cleanest method of inter-program communication on separate devices

I need to settle on a method of communication between multiple programs spread out over multiple machines.我需要确定分布在多台机器上的多个程序之间的通信方法。 The data itself is fairly straight forwards, comprising of variable length vectors with some meta-data descriptors.数据本身相当简单,由带有一些元数据描述符的可变长度向量组成。

Each program "type" will send data to 1 other program type, and expects to see a reply from it.每个程序“类型”都会将数据发送到其他 1 个程序类型,并希望看到它的回复。

The number of connections a given program has is variable over time, and programs can be added or removed at any moment.给定程序的连接数随时间而变化,并且可以随时添加或删除程序。

Programs may be distributed across several processors, which may use different operating systems, or could be microprocessors.程序可能分布在多个处理器上,这些处理器可能使用不同的操作系统,也可能是微处理器。

示例程序结构

I have not had to really contend with such a inter-communication puzzle before and am unsure of what the cleanest approach would be.我以前没有真正面对过这样一个相互沟通的难题,我不确定最干净的方法是什么。 I've heard that ROS might be useful, but that it may not be suitable for Windows environments and has a steep learning curve.我听说 ROS 可能有用,但它可能不适合 Windows 环境并且学习曲线陡峭。 I can imagine creating a database between the nodes which would act as a kind of blackboard, but this feels like it may be very inefficient.我可以想象在节点之间创建一个数据库,它可以充当一种黑板,但这感觉可能非常低效。 If using sockets would resolve efficiencies, then how would the connections be managed / maintained?如果使用 sockets 可以解决效率问题,那么如何管理/维护连接?

My main development environment at the moment is Julia, but I can port the data over to C++ or Python without too much discomfort.我目前的主要开发环境是 Julia,但我可以将数据移植到 C++ 或 Python 上,不会有太多不适。

I am open to ideas and learning new things, but I can't figure out which path to take.我对想法和学习新事物持开放态度,但我不知道该走哪条路。 Any nuggets of wisdom would be greatly appreciated.任何智慧的金块将不胜感激。


As requested in a comment, here is some additional information:根据评论中的要求,以下是一些附加信息:

  • Data: The data is a vector of floating point numbers, which can vary in size anywhere from 1 value to 1000's of values (maybe more depending on other aspects of the project, but I'm capping it for prototyping purposes).数据:数据是浮点数的向量,其大小可以从 1 个值到 1000 个值不等(可能更多取决于项目的其他方面,但我将其设置为原型目的)。 The meta-data is in json format and provides information such as the total length of the array, and a few identifiers (all integers).元数据采用 json 格式并提供诸如数组总长度和一些标识符(所有整数)等信息。
  • Reliability: I can handle a few missed messages here and there.可靠性:我可以在这里和那里处理一些错过的消息。 I'd need the data in the order it was sent though.我需要按照发送顺序的数据。 So if a packet of data arrives after a more recent one it will be ignored.因此,如果一个数据包在最近的一个数据包之后到达,它将被忽略。 (In case you were instead referring to data integrity, then the data must not be corrupted in transit). (如果您指的是数据完整性,则数据在传输过程中不得损坏)。
  • Latency: As little as possible as the program could start to introduce errors otherwise.延迟:尽可能少的程序可能会开始引入错误,否则。 That being said, for prototyping purposes I can persevere with 10's of milliseconds average, and irregular 100's of milliseconds.话虽如此,出于原型设计的目的,我可以坚持平均 10 毫秒,不规则的 100 毫秒。 I would very much like to keep this down though.不过,我非常想保持这种状态。
  • Standard IP Facilities: You may assume all devices have these, yes.标准 IP 设施:您可以假设所有设备都有这些,是的。

Perhaps taking a look at something well established (and therefore should be able to hook up to whichever language/s you end up using) like Redis or RabbitMQ would be wise seeing as you'll need to be able to communicate with a number of different devices over a network.也许看看一些成熟的东西(因此应该能够连接到你最终使用的任何一种语言),比如 Redis 或 RabbitMQ 会是明智的,因为你需要能够与许多不同的网络上的设备。 Either way having some form of central hub that handles communication among the other devices would be advisable.无论哪种方式,都建议使用某种形式的中央集线器来处理其他设备之间的通信。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM