UDP socket stops receiving data
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Respuestas (0)
Ver también
Categorías
Más información sobre Instrument Control Toolbox Supported Hardware en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!