Documentation ¶
Overview ¶
Package ktimeout configures kernel TCP stack timeouts via the provided control functions. Platform support varies; on unsupported platforms control functions may be entirely no-ops.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetUserTimeout ¶
SetUserTimeout sets the TCP_USER_TIMEOUT option on the given file descriptor.
func UserTimeout ¶
UserTimeout returns a control function that sets the TCP user timeout (TCP_USER_TIMEOUT on linux). A user timeout specifies the maximum age of unacknowledged data on the connection (either in buffer, or sent but not acknowledged) before the connection is terminated. This timer has no effect on limiting the lifetime of idle connections. This may be entirely local to the network stack or may also apply RFC 5482 options to packets.
Example ¶
lc := net.ListenConfig{ Control: UserTimeout(30 * time.Second), } l, err := lc.Listen(context.TODO(), "tcp", "127.0.0.1:0") if err != nil { fmt.Printf("error: %v", err) return } l.Close()
Output:
Types ¶
This section is empty.