mirror of
https://github.com/esphome/esphome.git
synced 2025-01-31 02:00:55 +00:00
Enable udp to work (on ipv4) when ipv6 is enabled (#8060)
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
parent
a498fb5dcf
commit
de603c7565
@ -245,13 +245,9 @@ void UDPComponent::setup() {
|
|||||||
}
|
}
|
||||||
struct sockaddr_in server {};
|
struct sockaddr_in server {};
|
||||||
|
|
||||||
socklen_t sl = socket::set_sockaddr_any((struct sockaddr *) &server, sizeof(server), this->port_);
|
server.sin_family = AF_INET;
|
||||||
if (sl == 0) {
|
server.sin_addr.s_addr = ESPHOME_INADDR_ANY;
|
||||||
ESP_LOGE(TAG, "Socket unable to set sockaddr: errno %d", errno);
|
server.sin_port = htons(this->port_);
|
||||||
this->mark_failed();
|
|
||||||
this->status_set_error("Unable to set sockaddr");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = this->listen_socket_->bind((struct sockaddr *) &server, sizeof(server));
|
err = this->listen_socket_->bind((struct sockaddr *) &server, sizeof(server));
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user