I have been developing a new driver for a QUECTEL modem. I am trying to run the Mbed OS tests using the new porting, all of them works as expected except two:
mbed-os-connectivity-netsocket-tests-tests-netsocket-udp : UDPSOCKET_ECHOTEST_BURST
mbed-os-connectivity-netsocket-tests-tests-netsocket-udp : UDPSOCKET_ECHOTEST_BURST_NONBLOCK
I have been reviewing those tests and they perform the following actions:
- They send multiple UDP packets of different data and lengths to an echo server.
- UDP packets are received using a buffer of the maximum packet length.
- UDP packets are checked to be received (even in a different order)
The problem is that, this tests are assuming that the UDP socket API will pop a UDP packet (and no more). For example, if we receive three packets of 100, 300 and 200 bytes and we try to read 600 bytes, we will have to perform three read operations and read 100, 300 and 200 bytes respectively.
The problem is that, in some modems, such as in QUECTEL ones, UDP datagrams are stored as if they were a TCP stream, it does not have delimiters for the different received packets so when you try to read 600 bytes, it will return you the three packets (in the order they have been received).
I actually don’t know how to approach this in order to make the component pass the tests.