- D (11416) WifiBridge: Waiting for interrupt
- D (12006) lwip: lwip_sendto(54, data=0x3fca467c, short_size=183, flags=0x0 to=
- D (12006) lwip: 255.255.255.255
- D (12006) lwip: port=6364
- D (12006) lwip: udp_send
- D (12006) lwip: udp_send: added header in given pbuf 0x3fcb7c7c
- D (12016) lwip: udp_send: sending datagram of length 191
- D (12016) lwip: udp_send: UDP packet length 191
- D (12026) lwip: udp_send: UDP checksum 0xbbff
- D (12026) lwip: udp_send: ip_output_if (,,,,0x11,)
- D (12036) lwip: ip4_output_if: st3
- D (12036) lwip: IP header:
- D (12036) lwip: +-------------------------------+
- D (12046) lwip: | 4 | 5 | 0x00 | 211 | (v, hl, tos, len)
- D (12046) lwip: +-------------------------------+
- D (12056) lwip: | 7 |000| 0 | (id, flags, offset)
- D (12066) lwip: +-------------------------------+
- D (12066) lwip: | 255 | 17 | 0xf8c0 | (ttl, proto, chksum)
- D (12076) lwip: +-------------------------------+
- D (12076) lwip: | 192 | 168 | 1 | 170 | (src)
- D (12086) lwip: +-------------------------------+
- D (12086) lwip: | 255 | 255 | 255 | 255 | (dest)
- D (12096) lwip: +-------------------------------+
- D (12096) lwip: ip4_output_if: call netif->output()
- D (12306) lwip: ip4_input: UDP packet to DHCP client port 5353
- D (12316) lwip: ip4_input: packet not for us.
- D (12396) WifiBridge: Interrupt triggered
- D (12396) WifiBridge: Received 34 bytes from mcu
- D (12396) lwip: lwip_sendto(58, data=0x3fc9dc74, short_size=34, flags=0x0 to=
- D (12396) lwip: 192.168.1.3
- D (12396) lwip: port=5000
- D (12406) lwip: udp_send
- E (12406) WifiBridge: Failed to send data to udp socket: 118
Been debugging this routine that sends UDP packets for the last couple hours, and not sure what to look at next. This is the ESP32-S3, as the only node making up an ESP Mesh Lite. It has connected to the router, it manages to get an IP address over DHCP and I can ping it.
When I send a UDP datagram, it fails with an errno of 118, which I believe means we're not connected to the network? But it definitely is. In the debug logs, I can see DHCP traffic continuing to arrive at the ESP32-S3.
Here's a snippet of the UDP code:
- int create_udp_socket() {
- int sock = socket(AF_INET, SOCK_DGRAM, 0);
- if (sock < 0) {
- ESP_LOGE(TAG, "Unable to create socket: errno %d", errno);
- return -1;
- }
- struct sockaddr_in addr = {
- .sin_family = AF_INET,
- .sin_port = htons(5000),
- .sin_addr.s_addr = inet_addr("192.168.1.3"),
- };
- if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- ESP_LOGE(TAG, "Failed to bind socket");
- return -1;
- }
- return sock;
- }
- ...
- struct sockaddr_in dest_addr = {
- .sin_family = AF_INET,
- .sin_port = htons(5000),
- .sin_addr.s_addr = inet_addr("192.168.1.3"),
- };
- if (-1 == sendto(udp_socket, rx_buffer, data_length, 0, (struct sockaddr *)&dest_addr, sizeof(dest_addr))) {
- ESP_LOGE(TAG, "Failed to send data to udp socket: %d", errno);
- }