problem with udp connection : can not read

3 vues (au cours des 30 derniers jours)
Bayan Ghanem
Bayan Ghanem le 2 Jan 2017
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 commentaires
john gutsch
john gutsch le 11 Juil 2018
Did you ever get this question answered? I am having the same problem.
xiaochun
xiaochun le 12 Juil 2019
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?

Connectez-vous pour commenter.

Réponses (1)

Pulkit Goel
Pulkit Goel le 25 Juin 2020
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.

Catégories

En savoir plus sur Get Started with Aerospace Blockset dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by