esp32/modsocket: Add support for SO_BROADCAST socket option.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
25b89cbe94
commit
56e5a21312
@ -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…
Reference in New Issue
Block a user