UDP socket stops receiving data

2 Ansichten (letzte 30 Tage)
Roberto Olmi
Roberto Olmi am 31 Mai 2012
Kommentiert: Ahmed Abdellatif am 26 Feb. 2018
I'm using UDP to exchange data between Matlab and another Windows application running on the same PC with Win 7.
Channel configuration:
u=udp('localhost',2000,'LocalPort',2001);
set(u,'InputBufferSize',30000);
set(u,'OutputBufferSize',30000);
fopen(u);
set(u,'Timeout',.1,'DatagramTerminateMode','Off');
I use the same channel both for sending and receiving data.
Function that reads:
allDataLen = u.BytesAvailable;
if allDataLen
[allData count]=fread(u,allDataLen);
Function that sends:
fwrite (u,messageData)
The system works for a lot (tens) of hours with tens of messages per second being transmitted and received. However sometimes the Matlab application stops detecting the received data (u.BytesAvailable==0). I checked with SocketSniff and the other application still sends messages. In this situation Matlab is still able to send data. I tried to close (with fclose(u)) and reopen the port but it doesn’t work. In order to make the port to work again I need to close and reopen it in a new instance of Matlab.
Is that a bug?
Roberto
  1 Kommentar
Ahmed Abdellatif
Ahmed Abdellatif am 26 Feb. 2018
Why there is no answer, i also have this issue!

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Instrument Control Toolbox Supported Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by