Testing UDP sample with sdk 1.7.0 I can't detect errors if the packet is not sent.
After a connection to networks and a few well-delivered packets, I put the device in a shield room with no network coverage. The send() function continues to return the number of characters sent normally even if no packet is actually received.
I expect the modem to detect transmission errors, but send() doesn't seem to be able to forward them.
How can I detect the transmission error?
static void server_transmission_work_fn(struct k_work *work) { int err; char buffer[CONFIG_UDP_DATA_UPLOAD_SIZE_BYTES] = {"\0"}; printk("Transmitting UDP/IP payload of %d bytes to the ", CONFIG_UDP_DATA_UPLOAD_SIZE_BYTES + UDP_IP_HEADER_SIZE); printk("IP address %s, port number %d\n", CONFIG_UDP_SERVER_ADDRESS_STATIC, CONFIG_UDP_SERVER_PORT); err = send(client_fd, buffer, sizeof(buffer), 0); if (err < 0) { printk("Failed to transmit UDP packet, %d\n", errno); return; } k_work_schedule(&server_transmission_work, K_SECONDS(CONFIG_UDP_DATA_UPLOAD_FREQUENCY_SECONDS)); }