libs/net
Low-Overhead Sockets & HTTP/1.1 Engine
Low-latency systems networking built directly on OS socket APIs. Provides asynchronous TCP listeners, client socket streams, chunked transfer encoding, connection pooling, and full HTTP/1.1 protocol parsing.

High-Throughput Systems Foundation
Engineered to maximize CPU instruction pipelining and data cache locality. Every algorithm avoids heap pointer indirection wherever contiguous stack or arena buffers can be employed.

import "libs/net/http.kl" as http;
import "libs/net/socket.kl" as sock;
fn main() -> int32 {
let server: http.Server = http.create_server("127.0.0.1", 8080);
print("Kale HTTP Server listening on port 8080\n");
while true {
let client: sock.Socket = http.accept_client(&server);
let req: http.Request = http.parse_request(&client);
let res: http.Response = http.response_ok("Hello from pure Kale HTTP Engine!\n");
http.send_response(&client, &res);
sock.close(&client);
}
return 0;
}Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:
kale build libs/net/smoke_test.kl -o bin/test_net.exe -lws2_32./bin/test_net.exeGPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.
Clean abstractions over socket, bind, listen, accept, connect, send, and recv with timeout handling.
Zero-copy HTTP request and response header parsing with Keep-Alive connection reuse.
Engineered with conditional compilation for Windows Winsock2 and POSIX socket systems.