I'm trying to send 8000 bytes from the OpenMV to my PC using sockets with the wifi shield. However, the OpenMV is not sending the message consistently.
Code: Select all
s = usocket.socket(usocket.AF_INET, usocket.SOCK_STREAM)
data = bytearray(os.urandom(8000)
On the PC side, I receive bytes from the socket until the length is 8000. As a test, I print out the lengths of the messages that the PC is receiving. Sometimes the OpenMV sends one message of 8000 bytes and the PC receives all 8000. Sometimes the OpenMV sends 5 messages of lengths 2800, 1400, 1400, 1400, 1000. Sometimes the OpenMV sends 5 messages of lengths 1400, 2800, 1400, 1400, 1000.
For my application, it would be great if the OpenMV is able to consistently send 8000 bytes at once. Or, at least I'd like the OpenMV to send predictable message sizes. The OpenMV uses the same wifi module as the Adafruit Feather M0, but I haven't had this problem with the Feather. Please advise.