mirror of https://github.com/ARMmbed/mbed-os.git
lwip: Fixed count of udp iterations to reflect attempts
parent
036f1cdfd4
commit
0887683a13
|
@ -81,15 +81,13 @@ int main() {
|
|||
SocketAddress udp_addr(ipbuf, port);
|
||||
|
||||
int success = 0;
|
||||
int i = 0;
|
||||
while (success < ECHO_LOOPS) {
|
||||
prep_buffer(uuid, uuid_len, tx_buffer, sizeof(tx_buffer));
|
||||
for (int i = 0; success < ECHO_LOOPS; i++) {
|
||||
const int ret = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
||||
if (ret >= 0) {
|
||||
printf("[%02d] sent %d bytes - %.*s \n", i, ret, ret, tx_buffer);
|
||||
} else {
|
||||
printf("[%02d] Network error %d\n", i, ret);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -99,7 +97,6 @@ int main() {
|
|||
printf("[%02d] recv %d bytes - %.*s \n", i, n, n, tx_buffer);
|
||||
} else {
|
||||
printf("[%02d] Network error %d\n", i, n);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -109,7 +106,6 @@ int main() {
|
|||
success += 1;
|
||||
|
||||
printf("[%02d] success #%d\n", i, success);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,9 +86,8 @@ public:
|
|||
|
||||
sock.set_timeout(MBED_CFG_UDP_CLIENT_ECHO_TIMEOUT);
|
||||
|
||||
int i = 0;
|
||||
while (success < ECHO_LOOPS) {
|
||||
prep_buffer(id, uuid_buffer, uuid_len, tx_buffer, sizeof(tx_buffer));
|
||||
for (int i = 0; success < ECHO_LOOPS; i++) {
|
||||
const int ret = sock.sendto(udp_addr, tx_buffer, sizeof(tx_buffer));
|
||||
if (ret >= 0) {
|
||||
iomutex.lock();
|
||||
|
@ -98,7 +97,6 @@ public:
|
|||
iomutex.lock();
|
||||
printf("[ID:%01d][%02d] Network error %d\n", id, i, ret);
|
||||
iomutex.unlock();
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -112,7 +110,6 @@ public:
|
|||
iomutex.lock();
|
||||
printf("[ID:%01d][%02d] Network error %d\n", id, i, n);
|
||||
iomutex.unlock();
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -123,8 +120,6 @@ public:
|
|||
iomutex.lock();
|
||||
printf("[ID:%01d][%02d] success #%d\n", id, i, success);
|
||||
iomutex.unlock();
|
||||
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue