4.2. Network socket library

The NETWORK module implements networking facilities including HTTP client/server and low-level socket operations. It provides Server and Client classes with event-driven callbacks for handling connections, requests, and responses.

All functions and symbols are in “network” module, use require to get access to it.

require daslib/network

4.2.1. Handled structures

NetworkServer

Base implementation of the server.

4.2.2. Low level NetworkServer IO

make_server(class: void?; info: StructInfo const?): bool

Creates a new Server instance.

Arguments:
  • class : void? implicit

  • info : StructInfo? implicit

server_init(server: NetworkServer?; port: int): bool

Initializes the server to listen on the specified port.

Arguments:
server_is_connected(server: NetworkServer?): bool

Returns true if the server has an active client connection.

Arguments:
server_is_open(server: NetworkServer?): bool

Returns true if the server is listening on its bound port.

Arguments:
server_restore(server: NetworkServer?; class: void?; info: StructInfo const?)

Restores a server from an orphaned or interrupted state.

Arguments:
server_send(server: NetworkServer?; data: uint8?; size: int): bool

Sends data from the server to the connected client.

Arguments:
  • server : NetworkServer? implicit

  • data : uint8? implicit

  • size : int

server_tick(server: NetworkServer?)

Processes pending network I/O; must be called periodically for the server to function.

Arguments: