boost::corosio::tcp_socket::set_linger

Set the SO_LINGER option.

Synopsis

void
set_linger(
    bool enabled,
    int timeout);

Description

Controls behavior when closing a socket with unsent data.

Exceptions

Name

Thrown on

std::logic_error

if the socket is not open.

std::system_error

on failure.

Parameters

Name Description

enabled

If true, close() will block until data is sent or the timeout expires. If false, close() returns immediately.

timeout

The linger timeout in seconds (only used if enabled).

Created with MrDocs