Module socket.constants

Pure LuaJIT bindings for Windows and Linux native socket libraries.

Module that exposes all constants related to the native socket libraries.

See also:

Info:

  • Copyright: 2026
  • Release: 0.0.0
  • License: CC0 1.0 Universal (CC0 1.0) (Public Domain)
  • Author: Herwin Bozet (NibblePoker)

Fields

_ALWAYS_DECLARE_PLATFORM_SPECIFIC Do not set to false if you use the wrapper ! Internal use only, may get removed in the future.

Address Families

AF_UNSPEC Unspecified address family.
AF_INET Internet IP Protocol (IPv4)
AF_NETBIOS Windows Sockets provider for NetBIOS
Only usable on 32bit Windows versions.
AF_UNIX Unix domain sockets
Only usable on Linux.
AF_LOCAL POSIX name for AF_UNIX
Only usable on Linux.
AF_AX25 Amateur Radio AX.25
Only usable on Linux.
AF_NETROM Amateur Radio NET/ROM
Only usable on Linux.
AF_BRIDGE Multiprotocol bridge
Only usable on Linux.
AF_ATMPVC ATM PVCs
Only usable on Linux.
AF_X25 Reserved for X.25 project
Only usable on Linux.
AF_ROSE Amateur Radio X.25 PLP
Only usable on Linux.
AF_DECnet Reserved for DECnet project
Only usable on Linux.
AF_NETBEUI Reserved for 802.2LLC project
Only usable on Linux.
AF_SECURITY Security callback pseudo AF
Only usable on Linux.
AF_KEY PF_KEY key management API
Only usable on Linux.
AF_NETLINK Communication between kernel and user space
Only usable on Linux.
AF_ROUTE Alias to emulate 4.4BSD
Only usable on Linux.
AF_PACKET Packet family
Only usable on Linux.
AF_ASH Ash
Only usable on Linux.
AF_ECONET Acorn Econet
Only usable on Linux.
AF_ATMSVC ATM SVCs
Only usable on Linux.
AF_RDS RDS sockets
Only usable on Linux.
AF_SNA Linux SNA Project (nutters!)
Only usable on Linux.
AF_PPPOX PPPoX sockets
Only usable on Linux.
AF_WANPIPE Wanpipe API Sockets
Only usable on Linux.
AF_LLC Linux LLC
Only usable on Linux.
AF_IB Native InfiniBand address
Only usable on Linux.
AF_MPLS MPLS
Only usable on Linux.
AF_CAN Controller Area Network
Only usable on Linux.
AF_TIPC TIPC sockets
Only usable on Linux.
AF_IUCV IUCV sockets
Only usable on Linux.
AF_RXRPC RxRPC sockets
Only usable on Linux.
AF_ISDN mISDN sockets
Only usable on Linux.
AF_PHONET Phonet sockets
Only usable on Linux.
AF_IEEE802154 IEEE802154 sockets
Only usable on Linux.
AF_CAIF CAIF sockets
Only usable on Linux.
AF_ALG Algorithm sockets
Only usable on Linux.
AF_NFC NFC sockets
Only usable on Linux.
AF_VSOCK vSockets
Only usable on Linux.
AF_KCM Kernel Connection Multiplexor
Only usable on Linux.
AF_QIPCRTR Qualcomm IPC Router
Only usable on Linux.
AF_APPLETALK AppleTalk protocol / DPP
Only usable on Windows before Vista.
AF_APPLETALK AppleTalk protocol / DPP
Only usable on Windows before Vista.
AF_IPX Novell’s IPX/SPX networking protocols
Only usable on Windows before Vista.
AF_IPX Novell’s IPX/SPX networking protocols
Only usable on Windows before Vista.
AF_INET6 IP version 6
Value differs from Win32 to Linux.
AF_INET6 IP version 6
Value differs from Win32 to Linux.
AF_IRDA IRDA sockets (Infrared Data Association)
Value differs from Win32 to Linux.
AF_IRDA IRDA sockets (Infrared Data Association)
Value differs from Win32 to Linux.
AF_BTH Bluetooth sockets (Windows' name variant)
Only usable on Windows XP SP2 or newer.
AF_BLUETOOTH Bluetooth sockets (Linux's name variant)
Only usable on Windows XP SP2 or newer.
AF_BTH Bluetooth sockets (Windows' name variant)
Only usable on Windows XP SP2 or newer.
AF_BLUETOOTH Bluetooth sockets (Linux's name variant)
Only usable on Windows XP SP2 or newer.

Socket Types

SOCK_STREAM Stream (connection) socket TCP-like, reliable, ordered, connection-based byte stream
SOCK_DGRAM Datagram (conn.less) socket UDP-like, unreliable, connectionless, fixed-size messages
SOCK_RAW Raw socket Direct protocol access, bypasses transport layer, you handle headers
SOCK_RDM Reliably-delivered message Reliable datagrams, delivery guaranteed, may not be ordered
SOCK_SEQPACKET Sequential packet socket Like STREAM but message-boundary-preserving — reliable + ordered + framed
SOCK_DCCP Datagram Congestion Control Protocol socket.
SOCK_PACKET Linux specific way of getting packets at the dev level.

Protocols

IPPROTO_ICMP Internet Control Message Protocol
IPPROTO_IGMP Internet Group Management Protocol
IPPROTO_TCP Transmission Control Protocol
IPPROTO_UDP User Datagram Protocol
IPPROTO_IP Dummy protocol for TCP
Only usable on Linux.
IPPROTO_IPIP IPIP tunnels (older KA9Q tunnels use 94)
Only usable on Linux.
IPPROTO_EGP Exterior Gateway Protocol
Only usable on Linux.
IPPROTO_PUP PUP protocol
Only usable on Linux.
IPPROTO_IDP XNS IDP protocol
Only usable on Linux.
IPPROTO_TP SO Transport Protocol Class 4
Only usable on Linux.
IPPROTO_DCCP Datagram Congestion Control Protocol
Only usable on Linux.
IPPROTO_IPV6 IPv6-in-IPv4 tunnelling
Only usable on Linux.
IPPROTO_RSVP RSVP Protocol
Only usable on Linux.
IPPROTO_GRE Cisco GRE tunnels (rfc 1701,1702)
Only usable on Linux.
IPPROTO_ESP Encapsulation Security Payload protocol
Only usable on Linux.
IPPROTO_AH Authentication Header protocol
Only usable on Linux.
IPPROTO_MTP Multicast Transport Protocol
Only usable on Linux.
IPPROTO_BEETPH IP option pseudo header for BEET
Only usable on Linux.
IPPROTO_ENCAP Encapsulation Header
Only usable on Linux.
IPPROTO_PIM Protocol Independent Multicast
Only usable on Linux.
IPPROTO_COMP Compression Header Protocol
Only usable on Linux.
IPPROTO_L2TP Layer 2 Tunnelling Protocol
Only usable on Linux.
IPPROTO_SCTP Stream Control Transport Protocol
Only usable on Linux.
IPPROTO_UDPLITE UDP-Lite (RFC 3828)
Only usable on Linux.
IPPROTO_MPLS MPLS in IP (RFC 4023)
Only usable on Linux.
IPPROTO_ETHERNET Ethernet-within-IPv6 Encapsulation
Only usable on Linux.
IPPROTO_AGGFRAG AGGFRAG in ESP (RFC 9347)
Only usable on Linux.
IPPROTO_RAW Raw IP packets
Only usable on Linux.
IPPROTO_SMC Shared Memory Communications
Only usable on Linux.
IPPROTO_MPTCP Multipath TCP connection
Only usable on Linux.
BTHPROTO_RFCOMM Bluetooth Radio Frequency Communications (Bluetooth RFCOMM)
Only usable on Windows XP SP2 or newer.
IPPROTO_ICMPV6 Internet Control Message Protocol Version 6 (ICMPv6)
Only usable on Windows XP or newer.
IPPROTO_RM PGM protocol for reliable multicast.

Socket IOCTL

FIONREAD Get number of bytes to read Should be equal to 1074030207.
FIONBIO Set/clear non-blocking I/O Should be equal to -2147195266.
FIOASYNC Set/clear async I/O Should be equal to -2147195267.

Others

SD_RECEIVE Shutdown receive operations.
SD_SEND Shutdown send operations.
SD_BOTH Shutdown both send and receive operations.
INVALID_SOCKET Test comment Note: Linux has another value or constant for the same use, figure it out later...


Fields

_ALWAYS_DECLARE_PLATFORM_SPECIFIC
Do not set to false if you use the wrapper ! Internal use only, may get removed in the future.

Address Families

AF_UNSPEC
Unspecified address family.
AF_INET
Internet IP Protocol (IPv4)
AF_NETBIOS
Windows Sockets provider for NetBIOS
Only usable on 32bit Windows versions.
AF_UNIX
Unix domain sockets
Only usable on Linux.

See also:

AF_LOCAL
POSIX name for AF_UNIX
Only usable on Linux.

See also:

AF_AX25
Amateur Radio AX.25
Only usable on Linux.
AF_NETROM
Amateur Radio NET/ROM
Only usable on Linux.
AF_BRIDGE
Multiprotocol bridge
Only usable on Linux.
AF_ATMPVC
ATM PVCs
Only usable on Linux.
AF_X25
Reserved for X.25 project
Only usable on Linux.
AF_ROSE
Amateur Radio X.25 PLP
Only usable on Linux.
AF_DECnet
Reserved for DECnet project
Only usable on Linux.
AF_NETBEUI
Reserved for 802.2LLC project
Only usable on Linux.
AF_SECURITY
Security callback pseudo AF
Only usable on Linux.
AF_KEY
PF_KEY key management API
Only usable on Linux.
AF_NETLINK
Communication between kernel and user space
Only usable on Linux.
AF_ROUTE
Alias to emulate 4.4BSD
Only usable on Linux.
AF_PACKET
Packet family
Only usable on Linux.
AF_ASH
Ash
Only usable on Linux.
AF_ECONET
Acorn Econet
Only usable on Linux.
AF_ATMSVC
ATM SVCs
Only usable on Linux.
AF_RDS
RDS sockets
Only usable on Linux.
AF_SNA
Linux SNA Project (nutters!)
Only usable on Linux.
AF_PPPOX
PPPoX sockets
Only usable on Linux.
AF_WANPIPE
Wanpipe API Sockets
Only usable on Linux.
AF_LLC
Linux LLC
Only usable on Linux.
AF_IB
Native InfiniBand address
Only usable on Linux.
AF_MPLS
MPLS
Only usable on Linux.
AF_CAN
Controller Area Network
Only usable on Linux.
AF_TIPC
TIPC sockets
Only usable on Linux.
AF_IUCV
IUCV sockets
Only usable on Linux.
AF_RXRPC
RxRPC sockets
Only usable on Linux.
AF_ISDN
mISDN sockets
Only usable on Linux.
AF_PHONET
Phonet sockets
Only usable on Linux.
AF_IEEE802154
IEEE802154 sockets
Only usable on Linux.
AF_CAIF
CAIF sockets
Only usable on Linux.
AF_ALG
Algorithm sockets
Only usable on Linux.
AF_NFC
NFC sockets
Only usable on Linux.
AF_VSOCK
vSockets
Only usable on Linux.
AF_KCM
Kernel Connection Multiplexor
Only usable on Linux.
AF_QIPCRTR
Qualcomm IPC Router
Only usable on Linux.
AF_APPLETALK
AppleTalk protocol / DPP
Only usable on Windows before Vista.
AF_APPLETALK
AppleTalk protocol / DPP
Only usable on Windows before Vista.
AF_IPX
Novell’s IPX/SPX networking protocols
Only usable on Windows before Vista.
AF_IPX
Novell’s IPX/SPX networking protocols
Only usable on Windows before Vista.
AF_INET6
IP version 6
Value differs from Win32 to Linux.
AF_INET6
IP version 6
Value differs from Win32 to Linux.
AF_IRDA
IRDA sockets (Infrared Data Association)
Value differs from Win32 to Linux.
AF_IRDA
IRDA sockets (Infrared Data Association)
Value differs from Win32 to Linux.
AF_BTH
Bluetooth sockets (Windows' name variant)
Only usable on Windows XP SP2 or newer.
Value differs from Win32 to Linux.

See also:

AF_BLUETOOTH
Bluetooth sockets (Linux's name variant)
Only usable on Windows XP SP2 or newer.
Value differs from Win32 to Linux.

See also:

AF_BTH
Bluetooth sockets (Windows' name variant)
Only usable on Windows XP SP2 or newer.
Value differs from Win32 to Linux.

See also:

AF_BLUETOOTH
Bluetooth sockets (Linux's name variant)
Only usable on Windows XP SP2 or newer.
Value differs from Win32 to Linux.

See also:

Socket Types

SOCK_STREAM
Stream (connection) socket TCP-like, reliable, ordered, connection-based byte stream
SOCK_DGRAM
Datagram (conn.less) socket UDP-like, unreliable, connectionless, fixed-size messages
SOCK_RAW
Raw socket Direct protocol access, bypasses transport layer, you handle headers
SOCK_RDM
Reliably-delivered message Reliable datagrams, delivery guaranteed, may not be ordered
SOCK_SEQPACKET
Sequential packet socket Like STREAM but message-boundary-preserving — reliable + ordered + framed
SOCK_DCCP
Datagram Congestion Control Protocol socket. Congestion-controlled, unreliable, connection-oriented datagrams
SOCK_PACKET
Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level.

Protocols

IPPROTO_ICMP
Internet Control Message Protocol
IPPROTO_IGMP
Internet Group Management Protocol
IPPROTO_TCP
Transmission Control Protocol
IPPROTO_UDP
User Datagram Protocol
IPPROTO_IP
Dummy protocol for TCP
Only usable on Linux.
IPPROTO_IPIP
IPIP tunnels (older KA9Q tunnels use 94)
Only usable on Linux.
IPPROTO_EGP
Exterior Gateway Protocol
Only usable on Linux.
IPPROTO_PUP
PUP protocol
Only usable on Linux.
IPPROTO_IDP
XNS IDP protocol
Only usable on Linux.
IPPROTO_TP
SO Transport Protocol Class 4
Only usable on Linux.
IPPROTO_DCCP
Datagram Congestion Control Protocol
Only usable on Linux.
IPPROTO_IPV6
IPv6-in-IPv4 tunnelling
Only usable on Linux.
IPPROTO_RSVP
RSVP Protocol
Only usable on Linux.
IPPROTO_GRE
Cisco GRE tunnels (rfc 1701,1702)
Only usable on Linux.
IPPROTO_ESP
Encapsulation Security Payload protocol
Only usable on Linux.
IPPROTO_AH
Authentication Header protocol
Only usable on Linux.
IPPROTO_MTP
Multicast Transport Protocol
Only usable on Linux.
IPPROTO_BEETPH
IP option pseudo header for BEET
Only usable on Linux.
IPPROTO_ENCAP
Encapsulation Header
Only usable on Linux.
IPPROTO_PIM
Protocol Independent Multicast
Only usable on Linux.
IPPROTO_COMP
Compression Header Protocol
Only usable on Linux.
IPPROTO_L2TP
Layer 2 Tunnelling Protocol
Only usable on Linux.
IPPROTO_SCTP
Stream Control Transport Protocol
Only usable on Linux.
IPPROTO_UDPLITE
UDP-Lite (RFC 3828)
Only usable on Linux.
IPPROTO_MPLS
MPLS in IP (RFC 4023)
Only usable on Linux.
IPPROTO_ETHERNET
Ethernet-within-IPv6 Encapsulation
Only usable on Linux.
IPPROTO_AGGFRAG
AGGFRAG in ESP (RFC 9347)
Only usable on Linux.
IPPROTO_RAW
Raw IP packets
Only usable on Linux.
IPPROTO_SMC
Shared Memory Communications
Only usable on Linux.
IPPROTO_MPTCP
Multipath TCP connection
Only usable on Linux.
BTHPROTO_RFCOMM
Bluetooth Radio Frequency Communications (Bluetooth RFCOMM)
Only usable on Windows XP SP2 or newer.
IPPROTO_ICMPV6
Internet Control Message Protocol Version 6 (ICMPv6)
Only usable on Windows XP or newer.

See also:

IPPROTO_RM
PGM protocol for reliable multicast.
Only usable on Windows.

Socket IOCTL

FIONREAD
Get number of bytes to read Should be equal to 1074030207.

See also:

FIONBIO
Set/clear non-blocking I/O Should be equal to -2147195266.

See also:

FIOASYNC
Set/clear async I/O Should be equal to -2147195267.

See also:

Others

SD_RECEIVE
Shutdown receive operations.
SD_SEND
Shutdown send operations.
SD_BOTH
Shutdown both send and receive operations.
INVALID_SOCKET
Test comment Note: Linux has another value or constant for the same use, figure it out later...
generated by LDoc 1.5.0 Last updated 2026-03-29 20:25:08