1
0
mirror of https://github.com/CPunch/Laika.git synced 2024-11-22 04:50:06 +00:00

Created Networking library (markdown)

CPunch 2022-07-12 16:56:04 -05:00
parent 765477b266
commit ba74d4deed

13
Networking-library.md Normal file

@ -0,0 +1,13 @@
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/lpolllist.c`.
## Socket abstraction
A thin wrapper library for basic socket operations exists in `lib/src/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/lpeer.c`. For details on each packet type and it's expected content, see `lib/include/lpacket.h`.