UDP socket stops receiving data
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Instrument Control Toolbox Supported Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!