mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net: added listen_backlog to enable custom backlog
This commit is contained in:
parent
015467778d
commit
5e0ae9a429
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user