UDP fread not returning entire datagram

1 vue (au cours des 30 derniers jours)
Jay
Jay le 15 Avr 2013
I have an application where I am using UDP to get data from another application. I have my UDP object in DatagramTerminateMode, and I am calling fread in my callback.
The application was working just fine until today, and I am not exactly sure what I changed. Some calls to fread are only returning 256 bytes instead of roughly 8000 bytes. If I add a command to my callback and leave off the semicolon it seems to make everything work again.
This would suggest that fread is being called before data is ready, but I am in DatagramTerminateMode so there should always be a datagram available when the callback is executed.
You may also be thinking... "are you sure that datagram isn't actually 256 bytes?" Well I am rather certain that is it not... When I debug the other application it appear to never be sending a datagram less than 8000 bytes.
  11 commentaires
Jay
Jay le 19 Avr 2013
Modifié(e) : Jay le 19 Avr 2013
I have modified the data portion of the UDP packets to simply be:
  • int32 Index
  • lots of zeros
  • 0xAA
I am using this index to line up the erronous packets in matlab with the packets in wireshark.
I run my matlab application with a breakpoint checking whether the entire datagram was read. I break in the case that there is a partially read datagram. I then read out the packet index from matlab and find that packet in wireshark.
Wireshark shows the packet correctly: index, lots of zeros, 0xAA. 505 bytes of data total.
Matlab reports that there are 505 data bytes, but only read 391 bytes. The bytes that it read are correct, it just ends before it gets to the 0xAA.
As a precaution I have set udpobject.Terminator = '';
Walter Roberson
Walter Roberson le 19 Avr 2013
I think you should take this to tech support.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Multicore Processor Targets 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