UDP socket stops receiving data

5 ビュー (過去 30 日間)
Roberto Olmi
Roberto Olmi 2012 年 5 月 31 日
コメント済み: Ahmed Abdellatif 2018 年 2 月 26 日
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 件のコメント
Ahmed Abdellatif
Ahmed Abdellatif 2018 年 2 月 26 日
Why there is no answer, i also have this issue!

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox Supported Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by