I'm trying to send data over ESP32 wifi (600 bytes every 25 msec) in non blocking send mode but after a while I got EWOULDBLOCK and if I disables nagle's algorithm I got ENOMEM
What should I do to make it send data correctly?
Code: Select all
while (1)
{
for ( i = 3; i > 0; i-- )
{
for ( len = 0 ; len < TEST_BUF_SIZE ; )
{
Buffer [len++] = (u32DataIdx >> 24 ) & 0xFF;
Buffer [len++] = (u32DataIdx >> 16 ) & 0xFF;
Buffer [len++] = (u32DataIdx >> 8 ) & 0xFF;
Buffer [len++] = (u32DataIdx ) & 0xFF;
u32DataIdx++;
}
ret = send( s, Buffer , TEST_BUF_SIZE, MSG_DONTWAIT );
if ( ret < 0) {
ESP_LOGE(TAG, "... socket send failed %d %d [%s]", ret, errno, strerror (errno));
}
else if ( ret < TEST_BUF_SIZE )
{
ESP_LOGE(TAG, "ret %d", ret);
}
}
vTaskDelay( 25 / portTICK_RATE_MS );
}