diff --git a/drivers/wifi/eswifi/eswifi.h b/drivers/wifi/eswifi/eswifi.h index b982cc39c64..c9ad9e278c5 100644 --- a/drivers/wifi/eswifi/eswifi.h +++ b/drivers/wifi/eswifi/eswifi.h @@ -140,6 +140,7 @@ int __eswifi_socket_new(struct eswifi_dev *eswifi, int family, int type, int proto, void *context); int __eswifi_off_start_client(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket); +int __eswifi_listen(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket, int backlog); int __eswifi_accept(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket); int __eswifi_bind(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket, const struct sockaddr *addr, socklen_t addrlen); diff --git a/drivers/wifi/eswifi/eswifi_socket.c b/drivers/wifi/eswifi/eswifi_socket.c index fb142066a7d..97767171adf 100644 --- a/drivers/wifi/eswifi/eswifi_socket.c +++ b/drivers/wifi/eswifi/eswifi_socket.c @@ -227,6 +227,25 @@ int __eswifi_off_start_client(struct eswifi_dev *eswifi, return 0; } +int __eswifi_listen(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket, int backlog) +{ + int err; + + __select_socket(eswifi, socket->index); + + /* Set backlog */ + snprintk(eswifi->buf, sizeof(eswifi->buf), "P8=%d\r", backlog); + err = eswifi_at_cmd(eswifi, eswifi->buf); + if (err < 0) { + LOG_ERR("Unable to start set listen backlog"); + err = -EIO; + } + + socket->is_server = true; + + return 0; +} + int __eswifi_accept(struct eswifi_dev *eswifi, struct eswifi_off_socket *socket) { char cmd[] = "P5=1\r";