bitflag enum io.SocketOptions

Overview

This enum lists all possible IO flags applicable to io.Socket class. More…

bitflag enum SocketOptions: io.StreamOptions {
    RawHeader,
    TcpKeepAlive,
    TcpNagle,
    TcpReset,
    UdpBroadcast,
    ReuseAddress,
    ReusePort,
    DisableMulticastLoopback,
};

Detailed Documentation

This enum lists all possible IO flags applicable to io.Socket class.

Enum Values

RawHeader

This option is used for setting the IP_HDRINCL flag for RAW sockets. When this property is set to true, the application must provide IP header together with the rest of the packet(however, the kernel may still overwrite certain fields, such as checksum).

For detailed description of raw sockets refer to: http://man7.org/linux/man-pages/man7/raw.7.html

TcpKeepAlive

Translates to SO_KEEPALIVE socket option.

TcpNagle

This option is used for turning the Nagle algorithm ON or OFF for TCP sockets. When this property is set to true, the socket attempts to delay the transmission of TCP data segments in order to reduce the overall number of transmitted packets.

For detailed description of Nagle algorithm refer to: http://en.wikipedia.org/wiki/Nagle’s_algorithm

TcpReset

This option is used for setting the disconnect type for TCP sockets – whether it should be graceful (via FIN sequence) or reset (via RST packet).

UdpBroadcast

This option is used for allowing the broadcast transmission over datagram-oriented protocols(such as UDP). When this option is set, the socket is allowed to send broadcast packets into the network.

ReuseAddress

Allow forcibly binding multiple sockets to the same local address (unless there’s an active listening a socket already bound to the same address). Internally maps to SO_REUSEADDR socket option.

ReusePort

Allow multiple sockets to bind to the same local address and port. Internally maps to SO_REUSEPORT socket option; ignored on platforms without SO_REUSEPORT (e.g., Windows).

DisableMulticastLoopback

Stop looping outgoing multicast datagrams back to local listeners (loopback is on by default). Internally maps to IP_MULTICAST_LOOP or IPV6_MULTICAST_LOOP socket option.