diff --git a/vlib/net/socket.v b/vlib/net/socket.v index 09ed9233c7..ffd9a5aa1b 100644 --- a/vlib/net/socket.v +++ b/vlib/net/socket.v @@ -88,6 +88,16 @@ pub fn (s Socket) listen() int { return res } +// put socket into passive mode with user specified backlog and wait to receive +pub fn (s Socket) listen_backlog(backlog int) int { + mut n := 0 + if backlog > 0 { + n = backlog + } + res := C.listen(s.sockfd, n) + return res +} + // helper method to create, bind, and listen given port number pub fn listen(port int) Socket { s := socket(AF_INET, SOCK_STREAM, 0)