Help us shape the future of Go! Take the 2026 Go Developer Survey

listen

package
v1.18.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TCP

func TCP(ctx context.Context, addr string) (net.Listener, error)

TCP wraps net.Listen("tcp", addr) with a retry budget around bind failures. After Listener.Close() returns, the kernel can still hold the bind for hundreds of milliseconds while accepted connections drain. Most visible on Windows during SIGHUP-driven runtime restart cycles, where the new runtime's net.Listen races the old listener's teardown of its accepted connections.

The platform-specific control hook (see listen_*.go) sets SO_REUSEADDR-equivalent options where they help, and the retry covers any remaining transient failure window. Real conflicts (port held by a different process for the whole budget) still surface.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL