Why do I stop receiving UDP data sent over Ethernet?
조회 수: 5 (최근 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!
댓글 수: 0
답변 (1개)
Ram Vijayaragavan
2020년 2월 6일
Hi Matt,
Please check the following answer on how to send data between two computers using udp:
I Hope this helps.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interface-Based Instrument Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!