Module socket.bindings
Pure LuaJIT bindings for Windows and Linux native socket libraries.
Module that provides basic and platform-dependant bindings for socket-related functions.
[TODO: Add note about exposing everything, and no-op-ing some functions].
See also:
Info:
- Copyright: 2026
- Release: 0.0.0
- License: CC0 1.0 Universal (CC0 1.0) (Public Domain)
- Author: Herwin Bozet (NibblePoker)
Functions
| socket () | Create an socket/endpoint for communication |
| closesocket () | Closes an existing socket |
| bind () | ??? |
| connect () | ??? |
| listen () | ??? |
| shutdown () | ??? |
| send () | ??? |
| ioctlsocket () | ??? |
| setsockopt () | ??? |
| accept () | ??? |
| recvfrom () | ??? |
| htons (host_ushort) | ??? |
| ntohs (net_ushort) | Converts a u_short from TCP/IP network byte order to host byte order. |
| htonl (host_ulong) | Converts a u_long from host to TCP/IP network byte order. |
| ntohl (net_ulong) | Converts a u_long from TCP/IP network order to host byte order. |
| inet_addr () | ??? |
| inet_ntoa () | Converts an (IPv4) Internet network address into an ASCII string in Internet standard dotted-decimal format. |
| WSACleanup () | ??? |
| WSAGetLastError () | Returns the last WinSock library error code. |
| WSASetLastError (integer) | Sets the last error code that is retrieved via WSAGetLastError(). |
| WSAStartup (USHORT, WSADATA) | Starts the WinSock library in order to be able to create sockets. |
Fields
| _ALWAYS_DECLARE_PLATFORM_SPECIFIC | Forces every platform-specific functions, constants and FFI structures to always be defined, even on unsupported platforms. |
Functions
- socket ()
-
Create an socket/endpoint for communication
See also:
Usage:
Linux:int socket(int domain, int type, int protocol);Win32:SOCKET socket(int af, int type, int protocol);
- closesocket ()
-
Closes an existing socket
See also:
Usage:
Linux:DOES NOT EXIST THEREWin32:SOCKET socket(int domain, int type, int protocol);
- bind ()
- ???
- connect ()
- ???
- listen ()
-
???
See also:
- shutdown ()
- ???
- send ()
- ???
- ioctlsocket ()
- ???
- setsockopt ()
- ???
- accept ()
- ???
- recvfrom ()
- ???
- htons (host_ushort)
-
???
Parameters:
- host_ushort integer The port in the host's byte order.
Returns:
-
integer The port in TCP/IP network byte order.
- ntohs (net_ushort)
-
Converts a u_short from TCP/IP network byte order to host byte order.
Parameters:
- net_ushort integer The port in TCP/IP network byte order.
Returns:
-
integer The port in the host's byte order.
- htonl (host_ulong)
-
Converts a u_long from host to TCP/IP network byte order.
Parameters:
- host_ulong integer
Returns:
-
integer
- ntohl (net_ulong)
-
Converts a u_long from TCP/IP network order to host byte order.
Parameters:
- net_ulong integer
Returns:
-
integer
- inet_addr ()
- ???
- inet_ntoa ()
- Converts an (IPv4) Internet network address into an ASCII string in Internet standard dotted-decimal format.
- WSACleanup ()
-
???
Returns:
-
integer
- WSAGetLastError ()
-
Returns the last WinSock library error code.
Returns:
-
integer
- WSASetLastError (integer)
-
Sets the last error code that is retrieved via
WSAGetLastError().Parameters:
- integer
iError A value from the
bindings.WSA*constants family.
Returns:
-
integer
- integer
iError A value from the
- WSAStartup (USHORT, WSADATA)
-
Starts the WinSock library in order to be able to create sockets.
Parameters:
- USHORT wVersionRequested
- WSADATA
- lpWSAData
Returns:
-
integer ???
Fields
- _ALWAYS_DECLARE_PLATFORM_SPECIFIC
-
Forces every platform-specific functions, constants and FFI structures to always be defined, even
on unsupported platforms.
Doesn't apply to FFI function imports, and unsupported functions will be replaced by an always failing no-op function.
IDEs won't take this behaviour into account !