Source file src/net/sock_windows.go

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package net
     6  
     7  import (
     8  	"internal/syscall/windows"
     9  	"os"
    10  	"syscall"
    11  )
    12  
    13  func maxListenerBacklog() int {
    14  	// When the socket backlog is SOMAXCONN, Windows will set the backlog to
    15  	// "a reasonable maximum value".
    16  	// See: https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen
    17  	return syscall.SOMAXCONN
    18  }
    19  
    20  func sysSocket(family, sotype, proto int) (syscall.Handle, error) {
    21  	s, err := wsaSocketFunc(int32(family), int32(sotype), int32(proto),
    22  		nil, 0, windows.WSA_FLAG_OVERLAPPED|windows.WSA_FLAG_NO_HANDLE_INHERIT)
    23  	if err != nil {
    24  		return syscall.InvalidHandle, os.NewSyscallError("socket", err)
    25  	}
    26  	return s, nil
    27  }
    28  

View as plain text