problem with udp connection : can not read
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I am trying to exchange data between two computers with UDP in MATLAB, here is the code
%sender
u=udp('192.168.91.88', 9090, 'LocalPort', 9091, 'InputBufferSize', 8192, 'TimeOut', 99);
fopen(u);
A=1:10;
fwrite(u,A);
fclose(u)
delete(u)
%rcvr
u1=udp('192.168.91.53', 9091,'LocalPort', 9090);
set(u1, 'OutputBufferSize', 8192)
set(u1, 'TimeOut', 99)
fopen(u1)
fread(u1)
fclose(u1)
delete(u1)
but this message keep appera
Warning: Unsuccessful read: The specified amount of data was not returned within the Timeout period.
what should I do. where is the mistake??
Regards
2 件のコメント
xiaochun
2019 年 7 月 12 日
I also have this same problem. I did a lot of search online, the reason seems that after fopen the udp, the BytesAvailouble is 0. But I have no idea how to make it more than zero?
回答 (1 件)
Pulkit Goel
2020 年 6 月 25 日
This issue may arise due to firewall blocking udp packets you are trying to recieve. You can try making some ports bypass your firewall using following steps:
Windows Defender Firewall > Inbound Rules > New Rule > Select Port > Next > Select UDP > Specify Porr of your Choice (you may select all, which is not recommended) > Allow the Connection > Next > Next > Enter name and description (for your convininence) > Finish
Follow same for Outbound Rules.
Also, try ignoring 'InputBufferSize' and 'OutputBufferSize' parameters and see if it is working then. You should also try checking if the packets are being transferred using Wireshark software.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with Aerospace Blockset についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!