3 Networking library
CPunch edited this page 2022-09-03 00:50:10 -05:00

Laika has it's own cross-platform networking layer for Windows & Linux environments (it should also work on any POSIX-compliant environment but it hasn't really been tested)

Polling

On Linux, epoll() is used instead of poll() to poll for socket events. The logic for all of this is in lib/src/net/lpolllist.c.

Socket abstraction

A thin wrapper library for basic socket operations exists in lib/src/net/lsocket.c. This handles common things like binding, connecting, sending, receiving & accepting connections for both Windows & Linux environments.

Lightweight encrypted packet protocol

Laika uses a simple keypair based packet encryption technique with LibSodium handling the cryptographic work. For details on how packets are handled, check lib/src/net/lpeer.c. For details on each packet type and it's expected content, see lib/include/net/lpacket.h.