Socket module

socket_init

procedure · 2 overloadsSource

Starts Winsock 2.2 and returns whether it is ready.

Winsock counts the calls, so calling it again is harmless. A failure is logged through context.logger and returns false. Call it once before the first socket call; on Unix it only returns true.

socket_init :: () -> bool

Starts Winsock 2.2 and returns whether it is ready.

Winsock counts the calls, so calling it again is harmless. A failure is logged through context.logger and returns false. Call it once before the first socket call; on Unix it only returns true.

Returns

bool
socket_init :: () -> bool

Prepares the socket layer and returns whether it is ready.

On Unix there is nothing to prepare and the result is always true. On Windows it starts Winsock 2.2, and a failure is logged through context.logger and returns false. Call it once before the first socket call in portable code; calling it again is harmless.

Returns

bool
Example
assert(socket_init());

Doesn't run in the browser (skipped on wasm).

See also