diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c index 13d8bc0821..2bc1c735ed 100644 --- a/net/socket/getsockopt.c +++ b/net/socket/getsockopt.c @@ -131,6 +131,16 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option, switch (option) { + case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */ + if (*value_len < sizeof(int)) + { + return -EINVAL; + } + + *(FAR int *)value = _SS_ISLISTENING(psock->s_flags); + *value_len = sizeof(int); + break; + /* The following options take a point to an integer boolean value. * We will blindly report the bit here although the implementation * is outside of the scope of getsockopt. @@ -268,7 +278,6 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option, /* The following are not yet implemented (return values other than {0,1) */ - case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */ case SO_LINGER: /* Lingers on a close() if data is present */ case SO_RCVBUF: /* Sets receive buffer size */ case SO_RCVLOWAT: /* Sets the minimum number of bytes to input */