Socket::Constants provides socket-related constants. All possible socket constants are listed in the documentation but they may not all be present on your platform.

If the underlying platform doesn’t define a constant the corresponding Ruby constant is not defined.

Constants

A stream socket provides a sequenced, reliable two-way connection for a byte stream

A datagram socket provides connectionless, unreliable messaging

A raw socket provides low-level access for direct access or implementing network protocols

A reliable datagram socket provides reliable delivery of messages

A sequential packet socket provides sequenced, reliable two-way connection for datagrams

Device-level packet access

Set the O_NONBLOCK file status flag on the open file description (see open(2)) referred to by the new file descriptor.

Set the close-on-exec (FD_CLOEXEC) flag on the new file descriptor.

Unspecified protocol, any supported address family

Unspecified protocol, any supported address family

IPv4 protocol

IPv4 protocol

IPv6 protocol

IPv6 protocol

UNIX sockets

UNIX sockets

AX.25 protocol

AX.25 protocol

IPX protocol

IPX protocol

AppleTalk protocol

AppleTalk protocol

Host-internal protocols

Host-internal protocols

ARPANET IMP protocol

ARPANET IMP protocol

PARC Universal Packet protocol

PARC Universal Packet protocol

MIT CHAOS protocols

MIT CHAOS protocols

XEROX NS protocols

XEROX NS protocols

ISO Open Systems Interconnection protocols

ISO Open Systems Interconnection protocols

ISO Open Systems Interconnection protocols

ISO Open Systems Interconnection protocols

European Computer Manufacturers protocols

European Computer Manufacturers protocols

Datakit protocol

Datakit protocol

CCITT (now ITU-T) protocols

CCITT (now ITU-T) protocols

IBM SNA protocol

IBM SNA protocol

DECnet protocol

DECnet protocol

DECnet protocol

DECnet protocol

DEC Direct Data Link Interface protocol

DEC Direct Data Link Interface protocol

Local Area Transport protocol

Local Area Transport protocol

NSC Hyperchannel protocol

NSC Hyperchannel protocol

Internal routing protocol

Internal routing protocol

Link layer interface

Link layer interface

Connection-oriented IP

Connection-oriented IP

Computer Network Technology

Computer Network Technology

Simple Internet Protocol

Simple Internet Protocol

Network driver raw access

Network driver raw access

Integrated Services Digital Network

Integrated Services Digital Network

Native ATM access

Native ATM access

Kernel event messages

Kernel event messages

NetBIOS

NetBIOS

Point-to-Point Protocol

Point-to-Point Protocol

Asynchronous Transfer Mode

Asynchronous Transfer Mode

Netgraph sockets

Netgraph sockets

Maximum address family for this platform

Maximum address family for this platform

Direct link-layer access

Direct link-layer access

CCITT (ITU-T) E.164 recommendation

eXpress Transfer Protocol

Help Identify RTIP packets

Help Identify PIP packets

Key management protocol, originally developed for usage with IPsec

Key management protocol, originally developed for usage with IPsec

Kernel user interface device

Kernel user interface device

Reliable Datagram Sockets (RDS) protocol

Reliable Datagram Sockets (RDS) protocol

Generic PPP transport layer, for setting up L2 tunnels (L2TP and PPPoE)

Generic PPP transport layer, for setting up L2 tunnels (L2TP and PPPoE)

Logical link control (IEEE 802.2 LLC) protocol

Logical link control (IEEE 802.2 LLC) protocol

InfiniBand native addressing

InfiniBand native addressing

Multiprotocol Label Switching

Multiprotocol Label Switching

Controller Area Network automotive bus protocol

Controller Area Network automotive bus protocol

TIPC, “cluster domain sockets” protocol

TIPC, “cluster domain sockets” protocol

Bluetooth low-level socket protocol

Bluetooth low-level socket protocol

Interface to kernel crypto API

Interface to kernel crypto API

VSOCK (originally “VMWare VSockets”) protocol for hypervisor-guest communication

VSOCK (originally “VMWare VSockets”) protocol for hypervisor-guest communication

KCM (kernel connection multiplexor) interface

KCM (kernel connection multiplexor) interface

XDP (express data path) interface

XDP (express data path) interface

Process out-of-band data

Peek at incoming message

Send without using the routing tables

Data completes record

Data discarded before delivery

Control data lost before delivery

Wait for full request or error

This message should be non-blocking

Data completes connection

Start of a hold sequence. Dumps to so_temp

Hold fragment in so_temp

Send the packet in so_temp

Data ready to be read

Data remains in the current packet

End of record

Wait for full request

Confirm path validity

Fetch message from error queue

Do not generate SIGPIPE

Sender will send more

Reduce step of the handshake process

Socket-level options

IP socket options

IPX socket options

AX.25 socket options

AppleTalk socket options

TCP socket options

UDP socket options

Dummy protocol for IP

Control message protocol

Group Management Protocol

Gateway to Gateway Protocol

Exterior Gateway Protocol

PARC Universal Packet protocol

XNS IDP

“hello” routing protocol

Sun net disk protocol

ISO transport protocol class 4

Xpress Transport Protocol

ISO cnlp

IP6 auth header

IP6 destination option

IP6 Encapsulated Security Payload

IP6 fragmentation header

IP6 hop-by-hop options

IP6 header

IP6 no next header

IP6 routing header

Raw IP packet

Maximum IPPROTO constant

Default minimum address for bind or connect

Default maximum address for bind or connect

A socket bound to INADDR_ANY receives packets from all interfaces and sends from the default IP address

The network broadcast address

The loopback address

The reserved multicast group

Multicast group for all systems on this subset

The last local network multicast group

A bitmask for matching no valid IP address

IP options to be included in packets

Header is included with data

IP type-of-service

IP time-to-live

Receive all IP options with datagram

Receive all IP options for response

Receive IP destination address with datagram

IP options to be included in datagrams

Minimum TTL allowed for received packets

Don’t fragment packets

Source address for outgoing UDP datagrams

Force outgoing broadcast datagrams to have the undirected broadcast address

Receive IP TTL with datagrams

Receive interface information with datagrams

Receive link-layer address with datagrams

Set the port range for sockets with unspecified port numbers

IP multicast interface

IP multicast TTL

IP multicast loopback

Add a multicast group membership

Drop a multicast group membership

Default multicast TTL

Default multicast loopback

Maximum number multicast groups a socket can join

Notify transit routers to more closely examine the contents of an IP packet

Receive packet information with datagrams

Receive packet options with datagrams

Path MTU discovery

Enable extended reliable error message passing

Receive TOS with incoming packets

The Maximum Transmission Unit of the socket

Allow binding to nonexistent IP addresses

IPsec security policy

Retrieve security context with datagram

Transparent proxy

Never send DF frames

Use per-route hints

Always send DF frames

Unblock IPv4 multicast packets with a give source address

Block IPv4 multicast packets with a give source address

Add a multicast group membership

Drop a multicast group membership

Multicast source filtering

Join a multicast group

Block multicast packets from this source

Unblock multicast packets from this source

Leave a multicast group

Join a multicast source group

Leave a multicast source group

Multicast source filtering

Exclusive multicast source filter

Inclusive multicast source filter

Debug info recording

Allow local address reuse

Allow local address and port reuse

Get the socket type

Get and clear the error status

Use interface addresses

Permit sending of broadcast messages

Send buffer size

Receive buffer size

Send buffer size without wmem_max limit (Linux 2.6.14)

Receive buffer size without rmem_max limit (Linux 2.6.14)

Keep connections alive

Leave received out-of-band data in-line

Disable checksums

The protocol-defined priority for all packets on this socket

Linger on close if data is present

Receive SCM_CREDENTIALS messages

The credentials of the foreign process connected to this socket

Receive low-water mark

Send low-water mark

Receive timeout

Send timeout

Socket has had listen() called on it

Bypass hardware when possible

There is an accept filter

Setting an identifier for ipfw purpose mainly

Retain unread data

Give a hint when more data is ready

OOB data is wanted in MSG_FLAG on receive

Get first packet byte count

Install socket-level Network Kernel Extension

Don’t SIGPIPE on EPIPE

Only send packets from the given interface

Attach an accept filter

Detach an accept filter

Obtain filter set by SO_ATTACH_FILTER (Linux 3.8)

Name of the connecting user

Receive timestamp with datagrams (timeval)

Receive nanosecond timestamp with datagrams (timespec)

Receive timestamp with datagrams (bintime)

Receive user credentials with datagram

Mandatory Access Control exemption for unlabeled peers

Bypass zone boundaries

Obtain the security credentials (Linux 2.6.2)

Toggle security context passing (Linux 2.6.18)

Set the mark for mark-based routing (Linux 2.6.25)

Time stamping of incoming and outgoing packets (Linux 2.6.30)

Protocol given for socket() (Linux 2.6.32)

Domain given for socket() (Linux 2.6.32)

Toggle cmsg for number of packets dropped (Linux 2.6.33)

Toggle cmsg for wifi status (Linux 3.3)

Set the peek offset (Linux 3.4)

Set netns of a socket (Linux 3.4)

Lock the filter attached to a socket (Linux 3.9)

Make select() detect socket error queue with errorfds (Linux 3.10)

Set the threshold in microseconds for low latency polling (Linux 3.11)

Cap the rate computed by transport layer. [bytes per second] (Linux 3.13)

Query supported BPF extensions (Linux 3.14)

Set the associated routing table for the socket (FreeBSD)

Set the routing table for this socket (OpenBSD)

Receive the cpu attached to the socket (Linux 3.19)

Receive the napi ID attached to a RX queue (Linux 4.12)

Returns the number of seconds a socket has been connected. This option is only valid for connection-oriented protocols (Windows)

Interactive socket priority

Normal socket priority

Background socket priority

Don’t delay sending to coalesce packets

Set maximum segment size

Retrieve information about this socket (macOS)

Don’t send partial frames (Linux 2.2, glibc 2.2)

Don’t notify a listening socket until data is ready (Linux 2.4, glibc 2.2)

Retrieve information about this socket (Linux 2.4, glibc 2.2)

Idle time before keepalive probes are sent (macOS)

Maximum number of keepalive probes allowed before dropping a connection (Linux 2.4, glibc 2.2)

Idle time before keepalive probes are sent (Linux 2.4, glibc 2.2)

Time between keepalive probes (Linux 2.4, glibc 2.2)

Lifetime of orphaned FIN_WAIT2 sockets (Linux 2.4, glibc 2.2)

Use MD5 digests (RFC2385, Linux 2.6.20, glibc 2.7)

Don’t use TCP options

Don’t push the last block of write

Enable quickack mode (Linux 2.4.4, glibc 2.3)

Number of SYN retransmits before a connection is dropped (Linux 2.4, glibc 2.2)

Clamp the size of the advertised window (Linux 2.4, glibc 2.2)

Reduce step of the handshake process (Linux 3.7, glibc 2.18)

TCP congestion control algorithm (Linux 2.6.13, glibc 2.6)

TCP Cookie Transactions (Linux 2.6.33, glibc 2.18)

Sequence of a queue for repair mode (Linux 3.5, glibc 2.18)

Repair mode (Linux 3.5, glibc 2.18)

Options for repair mode (Linux 3.5, glibc 2.18)

Queue for repair mode (Linux 3.5, glibc 2.18)

Duplicated acknowledgments handling for thin-streams (Linux 2.6.34, glibc 2.18)

Linear timeouts for thin-streams (Linux 2.6.34, glibc 2.18)

TCP timestamp (Linux 3.9, glibc 2.18)

Max timeout before a TCP connection is aborted (Linux 2.6.37, glibc 2.18)

Don’t send partial frames (Linux 2.5.44, glibc 2.11)

Address family for hostname not supported

Temporary failure in name resolution

Invalid flags

Non-recoverable failure in name resolution

Address family not supported

Memory allocation failure

No address associated with hostname

Hostname nor servname, or not known

Argument buffer overflow

Servname not supported for socket type

Socket type not supported

System error returned in errno

Invalid value for hints

Resolved protocol is unknown

Maximum error code from getaddrinfo

Get address to use with bind()

Fill in the canonical name

Prevent host name resolution

Prevent service name resolution

Valid flag mask for getaddrinfo (not for application use)

Allow all addresses

Accept IPv4 mapped addresses if the kernel supports it

Accept only if any address is assigned

Accept IPv4-mapped IPv6 addresses

Default flags for getaddrinfo

Maximum length of a hostname

Maximum length of a service name

An FQDN is not required for local hosts, return only the local part

Return a numeric address

A name is required

Return the service name as a digit string

The service specified is a datagram service (looks up UDP ports)

Shut down the reading side of the socket

Shut down the writing side of the socket

Shut down the both sides of the socket

Join a group membership

Leave a group membership

Path MTU discovery

IP6 multicast hops

IP6 multicast interface

IP6 multicast loopback

IP6 unicast hops

Only bind IPv6 with a wildcard bind

Checksum offset for raw sockets

Don’t fragment packets

Destination option

Hop limit

Hop-by-hop option

Next hop address

Retrieve current path MTU

Receive packet information with datagram

Receive all IP6 options for response

Enable extended reliable error message passing

Receive hop limit with datagram

Receive hop-by-hop options

Receive destination IP address and incoming interface

Receive routing header

Receive traffic class

Allows removal of sticky routing headers

Allows removal of sticky destination options header

Routing header type 0

Receive current path MTU with datagram

Specify the traffic class

Use the minimum MTU size

Maximum length of an IPv4 address string

Maximum length of an IPv6 address string

Maximum interface name size

Maximum interface name size

Maximum connection requests that may be queued for a socket

Access rights

Timestamp (timeval)

Timespec (timespec)

Timestamp (timespec list) (Linux 2.6.30)

Timestamp (bintime)

The sender’s credentials

Process credentials

User credentials

Wifi status (Linux 3.3)

Retrieve peer credentials

Pass credentials to receiver

Connect blocks until accepted

802.1Q VLAN device

receive all multicast packets

use alternate physical connection

auto media select active

bonding master or slave

device used as bridge port

broadcast address valid

unconfigurable using ioctl(2)

turn on debugging

disable netpoll at run-time

disallow bridging this ether dev

driver signals dormant

tx hardware queue is full

resources allocated

interface is winding down

dialup device with changing addresses

ethernet bridging device

echo sent packets

ISATAP interface (RFC4214)

per link layer defined bit 0

per link layer defined bit 1

per link layer defined bit 2

hardware address change when it’s running

loopback net

driver signals L1 up

device used as macvlan port

master of a load balancer

bonding master, 802.3ad.

bonding master, balance-alb.

bonding master, ARP mon in use

user-requested monitor mode

supports multicast

no address resolution protocol

avoid use of trailers

transmission in progress

device used as Open vSwitch datapath port

point-to-point link

can set media type

user-requested promisc mode

receive all packets

interface is being renamed

routing entry installed

resources allocated

can’t hear own transmissions

slave of a load balancer

bonding slave not the curr. active

need ARPs for validation

interface manages own routes

static ARP

sending custom FCS

used as team port

sharing skbs on transmit

unicast filtering

interface is up

WAN HDLC device

dev_hard_start_xmit() is allowed to release skb->dst

volatile flags

flags not changeable