listen

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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