How do I send data between two computers using the UDP function from the Instrument Control Toolbox?

24 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
MathWorks Support Team 2025-10-27,0:00
编辑:MathWorks Support Team 2025-10-27,17:42
Please see this example in our documentation for the best way to communicate between two MATLAB sessions using UDP:
  1 个评论
Walter Roberson
Walter Roberson 2016-10-21
Nabeel Afridi, you can fwrite() the array in binary, or you can fprintf() the array. The code above shows a string being sent, and strings are arrays (of characters.) If the array is not fixed size you might be wanting to send the size information just before you send the array.

请先登录,再进行评论。

更多回答(1 个)

Vinod
Vinod 2014-4-14
编辑:MathWorks Support Team 2023-4-27
The UDP protocol does not guarantee transmission or order of the packets.
For most applications, you probably want to use TCPIP, like this:
  1 个评论
Walter Roberson
Walter Roberson 2014-4-14
Real-time communications require UDP rather than TCP, as TCP has no upper bound on packet delivery time and does not allow later packets to be delivered.
TCP is also not usable for broadcasting of any kind.
Effectively all other IP protocols other than TCP are unidirectional, so there are a lot of different applications where in-order guaranteed delivery is not suitable.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Development Computer Setup 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by