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

23 visualizaciones (últimos 30 días)
I am using the Instrument Control Toolbox, and I would like to communicate between two computers using the User Datagram Protocol (UDP).

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Oct. de 2025 a las 0:00
Editada: MathWorks Support Team el 27 de Oct. de 2025 a las 17:42
Please see this example in our documentation for the best way to communicate between two MATLAB sessions using UDP:
  1 comentario
Walter Roberson
Walter Roberson el 21 de Oct. de 2016
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.

Iniciar sesión para comentar.

Más respuestas (1)

Vinod
Vinod el 14 de Abr. de 2014
Editada: MathWorks Support Team el 27 de Abr. de 2023
The UDP protocol does not guarantee transmission or order of the packets.
For most applications, you probably want to use TCPIP, like this:
  1 comentario
Walter Roberson
Walter Roberson el 14 de Abr. de 2014
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.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by