Module socket.enums
Pure LuaJIT bindings for Windows and Linux native socket libraries.
Module that exposes enums for 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)
Tables
| AddressFamilies | Enum of all address families that can be used in socket(), connect() and bind(). |
| SocketTypes | Test 123 |
| Protocols | Enum of all standardized protocols than can be used in the connect() function. |
| ShutdownFlags | Test 123 |
| BindingAddresses | Test 123 |
| IoctlCommands | Enum of standard Winsock2 commands for ioctlsocket(). |
| WSAErrorCodes | Enum of errors that can be returned by the WinSock APIs either directly, or through WSAGetLastError. |
Tables
- AddressFamilies
-
Enum of all address families that can be used in
socket(),connect()andbind().Fields:
- AF_UNSPEC Internet IP Protocol (IPv4)
- AF_INET
Windows Sockets provider for NetBIOS
Only usable on 32bit Windows versions. - AF_NETBIOS
Unix domain sockets
Only usable on Linux. @see AddressFamilies.AF_LOCAL - AF_UNIX
POSIX name for AFUNIX
Only usable on Linux. @see AddressFamilies.AFUNIX - AF_LOCAL
Amateur Radio AX.25
Only usable on Linux. - AF_AX25
Amateur Radio NET/ROM
Only usable on Linux. - AF_NETROM
Multiprotocol bridge
Only usable on Linux. - AF_BRIDGE
ATM PVCs
Only usable on Linux. - AF_ATMPVC
Reserved for X.25 project
Only usable on Linux. - AF_X25
Amateur Radio X.25 PLP
Only usable on Linux. - AF_ROSE
Reserved for DECnet project
Only usable on Linux. - AF_DECnet
Reserved for 802.2LLC project
Only usable on Linux. - AF_NETBEUI
Security callback pseudo AF
Only usable on Linux. - AF_SECURITY
PF_KEY key management API
Only usable on Linux. - AF_KEY
Communication between kernel and user space
Only usable on Linux. - AF_NETLINK
Alias to emulate 4.4BSD
Only usable on Linux. - AF_ROUTE
Packet family
Only usable on Linux. - AF_PACKET
Ash
Only usable on Linux. - AF_ASH
Acorn Econet
Only usable on Linux. - AF_ECONET
ATM SVCs
Only usable on Linux. - AF_ATMSVC
RDS sockets
Only usable on Linux. - AF_RDS
Linux SNA Project (nutters!)
Only usable on Linux. - AF_SNA
PPPoX sockets
Only usable on Linux. - AF_PPPOX
Wanpipe API Sockets
Only usable on Linux. - AF_WANPIPE
Linux LLC
Only usable on Linux. - AF_LLC
Native InfiniBand address
Only usable on Linux. - AF_IB
MPLS
Only usable on Linux. - AF_MPLS
Controller Area Network
Only usable on Linux. - AF_CAN
TIPC sockets
Only usable on Linux. - AF_TIPC
IUCV sockets
Only usable on Linux. - AF_IUCV
RxRPC sockets
Only usable on Linux. - AF_RXRPC
mISDN sockets
Only usable on Linux. - AF_ISDN
Phonet sockets
Only usable on Linux. - AF_PHONET
IEEE802154 sockets
Only usable on Linux. - AF_IEEE802154
CAIF sockets
Only usable on Linux. - AF_CAIF
Algorithm sockets
Only usable on Linux. - AF_ALG
NFC sockets
Only usable on Linux. - AF_NFC
vSockets
Only usable on Linux. - AF_VSOCK
Kernel Connection Multiplexor
Only usable on Linux. - AF_KCM
Qualcomm IPC Router
Only usable on Linux. - MF_QIPCRTR
AppleTalk protocol / DPP
Only usable on Windows before Vista. - AF_APPLETALK
Novell’s IPX/SPX networking protocols
Only usable on Windows before Vista. - AF_IPX
IP version 6
Value differs from Win32 to Linux. - AF_INET6
IRDA sockets (Infrared Data Association)
Value differs from Win32 to Linux. - AF_IRDA
Bluetooth sockets (Windows' name variant)
Only usable on Windows XP SP2 or newer.
Value differs from Win32 to Linux. @see AddressFamilies.AF_BLUETOOTH - AF_BTH
Bluetooth sockets (Linux's name variant)
Only usable on Windows XP SP2 or newer.
Value differs from Win32 to Linux. @see AddressFamilies.AF_BTH - AF_BLUETOOTH
Returns:
-
Unspecified address family.
See also:
- SocketTypes
-
Test 123
Fields:
- -- TCP-like, reliable, ordered, connection-based byte stream Datagram (conn.less) socket UDP-like, unreliable, connectionless, fixed-size messages
- SOCK_DGRAM Raw socket Direct protocol access, bypasses transport layer, you handle headers
- SOCK_RAW Reliably-delivered message Reliable datagrams, delivery guaranteed, may not be ordered
- SOCK_RDM Sequential packet socket Like STREAM but message-boundary-preserving — reliable + ordered + framed
- SOCK_SEQPACKET Datagram Congestion Control Protocol socket. Congestion-controlled, unreliable, connection-oriented datagrams
- SOCK_DCCP Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level.
- SOCK_PACKET
Returns:
-
Stream (connection) socket
- Protocols
-
Enum of all standardized protocols than can be used in the
connect()function.
Please note that Windows supports a limited and distinct subset from Linux !Fields:
- IPPROTO_ICMP Internet Group Management Protocol
- IPPROTO_IGMP Transmission Control Protocol
- IPPROTO_TCP User Datagram Protocol
- IPPROTO_UDP
Dummy protocol for TCP
Only usable on Linux. - IPPROTO_IP
IPIP tunnels (older KA9Q tunnels use 94)
Only usable on Linux. - IPPROTO_IPIP
Exterior Gateway Protocol
Only usable on Linux. - IPPROTO_EGP
PUP protocol
Only usable on Linux. - IPPROTO_PUP
XNS IDP protocol
Only usable on Linux. - IPPROTO_IDP
SO Transport Protocol Class 4
Only usable on Linux. - IPPROTO_TP
Datagram Congestion Control Protocol
Only usable on Linux. - IPPROTO_DCCP
IPv6-in-IPv4 tunnelling
Only usable on Linux. - IPPROTO_IPV6
RSVP Protocol
Only usable on Linux. - IPPROTO_RSVP
Cisco GRE tunnels (rfc 1701,1702)
Only usable on Linux. - IPPROTO_GRE
Encapsulation Security Payload protocol
Only usable on Linux. - IPPROTO_ESP
Authentication Header protocol
Only usable on Linux. - IPPROTO_AH
Multicast Transport Protocol
Only usable on Linux. - IPPROTO_MTP
IP option pseudo header for BEET
Only usable on Linux. - IPPROTO_BEETPH
Encapsulation Header
Only usable on Linux. - IPPROTO_ENCAP
Protocol Independent Multicast
Only usable on Linux. - IPPROTO_PIM
Compression Header Protocol
Only usable on Linux. - IPPROTO_COMP
Layer 2 Tunnelling Protocol
Only usable on Linux. - IPPROTO_L2TP
Stream Control Transport Protocol
Only usable on Linux. - IPPROTO_SCTP
UDP-Lite (RFC 3828)
Only usable on Linux. - IPPROTO_UDPLITE
MPLS in IP (RFC 4023)
Only usable on Linux. - IPPROTO_MPLS
Ethernet-within-IPv6 Encapsulation
Only usable on Linux. - IPPROTO_ETHERNET
AGGFRAG in ESP (RFC 9347)
Only usable on Linux. - IPPROTO_AGGFRAG
Raw IP packets
Only usable on Linux. - IPPROTO_RAW
Shared Memory Communications
Only usable on Linux. - IPPROTO_SMC
Multipath TCP connection
Only usable on Linux. - IPPROTO_MPTCP
Bluetooth Radio Frequency Communications (Bluetooth RFCOMM)
Only usable on Windows XP SP2 or newer. - BTHPROTO_RFCOMM
Internet Control Message Protocol Version 6 (ICMPv6)
Only usable on Windows XP or newer. @see AFUNSPEC @see AFINET @see AFINET6 @see SOCKRAW - IPPROTO_ICMPV6
PGM protocol for reliable multicast.
Only usable on Windows. - IPPROTO_RM
Returns:
-
Internet Control Message Protocol
See also:
- ShutdownFlags
-
Test 123
Fields:
- SD_RECEIVE Shutdown send operations.
- SD_SEND Shutdown both send and receive operations.
- SD_BOTH
Returns:
-
Shutdown receive operations.
- BindingAddresses
-
Test 123
Fields:
- INADDR_ANY
- INADDR_NONE
- IoctlCommands
-
Enum of standard Winsock2 commands for
ioctlsocket().Fields:
- FIONREAD Set/clear non-blocking I/O
- FIONBIO Set/clear async I/O
- FIOASYNC
Returns:
-
Get number of bytes to read
See also:
- WSAErrorCodes
-
Enum of errors that can be returned by the WinSock APIs either directly, or through
WSAGetLastError.
Only relevant on Windows.Fields:
- WSA_INVALID_HANDLE
- WSA_NOT_ENOUGH_MEMORY
- WSA_INVALID_PARAMETER
- WSA_OPERATION_ABORTED
- WSA_IO_INCOMPLETE
- WSA_IO_PENDING
- WSAEINTR
- WSAEBADF
- WSAEACCES
- WSAEFAULT
- WSAEINVAL
- WSAEMFILE
- WSAEWOULDBLOCK
- WSAEINPROGRESS
- WSAEALREADY
- WSAENOTSOCK
- WSAEDESTADDRREQ
- WSAEMSGSIZE
- WSAEPROTOTYPE
- WSAENOPROTOOPT
- WSAEPROTONOSUPPORT
- WSAESOCKTNOSUPPORT
- WSAEOPNOTSUPP
- WSAEPFNOSUPPORT
- WSAEAFNOSUPPORT
- WSAEADDRINUSE
- WSAEADDRNOTAVAIL
- WSAENETDOWN
- WSAENETUNREACH
- WSAENETRESET
- WSAECONNABORTED
- WSAECONNRESET
- WSAENOBUFS
- WSAEISCONN
- WSAENOTCONN
- WSAESHUTDOWN
- WSAETOOMANYREFS
- WSAETIMEDOUT
- WSAECONNREFUSED
- WSAELOOP
- WSAENAMETOOLONG
- WSAEHOSTDOWN
- WSAEHOSTUNREACH
- WSAENOTEMPTY
- WSAEPROCLIM
- WSAEUSERS
- WSAEDQUOT
- WSAESTALE
- WSAEREMOTE
- WSASYSNOTREADY
- WSAVERNOTSUPPORTED
- WSANOTINITIALISED
- WSAEDISCON
- WSAENOMORE
- WSAECANCELLED
- WSAEINVALIDPROCTABLE
- WSAEINVALIDPROVIDER
- WSAEPROVIDERFAILEDINIT
- WSASYSCALLFAILURE
- WSASERVICE_NOT_FOUND
- WSATYPE_NOT_FOUND
- WSA_E_NO_MORE
- WSA_E_CANCELLED
- WSAEREFUSED
- WSAHOST_NOT_FOUND
- WSATRY_AGAIN
- WSANO_RECOVERY
- WSANO_DATA
- WSA_QOS_RECEIVERS
- WSA_QOS_SENDERS
- WSA_QOS_NO_SENDERS
- WSA_QOS_NO_RECEIVERS
- WSA_QOS_REQUEST_CONFIRMED
- WSA_QOS_ADMISSION_FAILURE
- WSA_QOS_POLICY_FAILURE
- WSA_QOS_BAD_STYLE
- WSA_QOS_BAD_OBJECT
- WSA_QOS_TRAFFIC_CTRL_ERROR
- WSA_QOS_GENERIC_ERROR
- WSA_QOS_ESERVICETYPE
- WSA_QOS_EFLOWSPEC
- WSA_QOS_EPROVSPECBUF
- WSA_QOS_EFILTERSTYLE
- WSA_QOS_EFILTERTYPE
- WSA_QOS_EFILTERCOUNT
- WSA_QOS_EOBJLENGTH
- WSA_QOS_EFLOWCOUNT
- WSA_QOS_EUNKOWNPSOBJ
- WSA_QOS_EPOLICYOBJ
- WSA_QOS_EFLOWDESC
- WSA_QOS_EPSFLOWSPEC
- WSA_QOS_EPSFILTERSPEC
- WSA_QOS_ESDMODEOBJ
- WSA_QOS_ESHAPERATEOBJ
- WSA_QOS_RESERVED_PETYPE
See also: