diff options
| author | Max Hilbrunner | 2018-06-05 12:54:39 +0200 |
|---|---|---|
| committer | GitHub | 2018-06-05 12:54:39 +0200 |
| commit | 6a69f92370ba82befdfdf3c2f798b6b2fd6df1fb (patch) | |
| tree | f7618660828f86dc9ad4ba1204583df1570efb7c /drivers/unix | |
| parent | 36c70bbcd02c963f133ed4011006668a2f64197a (diff) | |
| parent | 69817232ff5b363a9f98696548ecd9c99c7a80e2 (diff) | |
| download | godot-6a69f92370ba82befdfdf3c2f798b6b2fd6df1fb.tar.gz godot-6a69f92370ba82befdfdf3c2f798b6b2fd6df1fb.tar.zst godot-6a69f92370ba82befdfdf3c2f798b6b2fd6df1fb.zip | |
Diffstat (limited to 'drivers/unix')
| -rw-r--r-- | drivers/unix/socket_helpers.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/unix/socket_helpers.h b/drivers/unix/socket_helpers.h index 5ef9ad308..5b42c13ea 100644 --- a/drivers/unix/socket_helpers.h +++ b/drivers/unix/socket_helpers.h @@ -124,6 +124,13 @@ static int _socket_create(IP::Type &p_type, int type, int protocol) { WARN_PRINT("Unable to set/unset IPv4 address mapping over IPv6"); } } + if (protocol == IPPROTO_UDP && p_type != IP::TYPE_IPV6) { + // Enable broadcasting for UDP sockets if it's not IPv6 only (IPv6 has no broadcast option). + int broadcast = 1; + if (setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof(broadcast)) != 0) { + WARN_PRINT("Error when enabling broadcasting"); + } + } return sockfd; } |
