Why do I stop receiving UDP data sent over Ethernet?

8 次查看(过去 30 天)
I have two laptops, each recording data from separate instruments using TCP/IP. In order to time-synchronize the data collected from both laptops, I must send a signal (trigger) from one laptop to the other. To do this, one computer sends a UDP packet containing a 1 or 2, which is read in from the ethernet port (2222) on the other computer through a MatLab UDP object. Once received, I know when both data recodings begin/end.
Sometimes all will work fine, sometimes the UDP packets stop receiving after the first trigger, sometimes nothing is received at all. As far as I can tell, the first laptop is sending the triggers correctly, and on the other laptop, the ethernet port is always open and the UDP object listening to it.
There appears to be no consistent pattern leading to this issue - opening one laptop before the other, sending triggers repeatedly, etc.
Every time that I set up the UDP object, I make sure that all previously open/connected ports are closed and workspace variables/objects are deleted and cleared.
fclose(Data); % Data = TCP/IP object for data recording
fclose(Trigger); % Trigger = UDP object for receiving trigger value (1 or 2)
delete(Data);
delete(Trigger);
clear Data Trigger
I also use instrreset to refresh the ports.
instrreset
I am aware that UDP is not a reliable protocol to transmit data, but the random failure to receive data using the MatLab UDP object is baffling...
Any help would be greatly appreciated!

回答(1 个)

Ram Vijayaragavan
Hi Matt,
Please check the following answer on how to send data between two computers using udp:
I Hope this helps.

类别

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

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by