How do I make continue goes to the top level of loop? I mean like this:
for(;;){ // top level loop
statement1;
for(;;){ // second level loop
statement2;
if (condition1){
continue; // I expect it continue to the start of top level so it will execute statement1.
}
}
statement3;
}
This is my real case why I got problem above, basically my program is sending data with UDP socket which the data should be sent fast. I know UDP is unrealiable but it's okay the data is tolerated with loss too.
for (;;) { // Streaming data...
camera_fb_t* fb = esp_camera_fb_get();
size_t quotient = fb ->len / UDP_BUF_SIZE;
size_t remainder = fb ->len % UDP_BUF_SIZE;
unsigned int i = 0;
for (; i < quotient; i++) { // sending packet by packet.
if (uwc_udp_send_raw((const void*)(fb ->buf + (i * UDP_BUF_SIZE)),
UDP_BUF_SIZE) < 0) {
ESP_LOGE(uwc_tag_event, "Error in itteration: %i", i);
uwc_udp_send_raw("ERR",3); // Tell receiver there was corrupt during send data.
esp_camera_fb_return(fb);
continue; // I expect it continue to the top level
}
}
if (remainder) { // last packet to be sent if remainder exist
uwc_udp_send_raw((const void*)(fb ->buf + (i * UDP_BUF_SIZE)),
remainder);
ESP_LOGE(uwc_tag_event, "Error in last itteration!");
}
esp_camera_fb_return(fb);
}