Browse Source

esp32/modsocket: Add support for SO_BROADCAST socket option.

Signed-off-by: Damien George <damien@micropython.org>
pull/11818/head
Damien George 1 year ago
parent
commit
56e5a21312
  1. 4
      ports/esp32/modsocket.c

4
ports/esp32/modsocket.c

@ -386,7 +386,8 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
switch (opt) {
// level: SOL_SOCKET
case SO_REUSEADDR: {
case SO_REUSEADDR:
case SO_BROADCAST: {
int val = mp_obj_get_int(args[3]);
int ret = lwip_setsockopt(self->fd, SOL_SOCKET, opt, &val, sizeof(int));
if (ret != 0) {
@ -858,6 +859,7 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(IPPROTO_IP) },
{ MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(SOL_SOCKET) },
{ MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(SO_REUSEADDR) },
{ MP_ROM_QSTR(MP_QSTR_SO_BROADCAST), MP_ROM_INT(SO_BROADCAST) },
{ MP_ROM_QSTR(MP_QSTR_IP_ADD_MEMBERSHIP), MP_ROM_INT(IP_ADD_MEMBERSHIP) },
};

Loading…
Cancel
Save