Back to project.

Raw source file available here .

// Written by retoor@molodetz.nl

// This program sets up a network socket server using `nsock` and hooks up functions to handle events like connection, data reception, and
// closing.

// External dependency used: nsock

// MIT License

#include "nsock.h"

void on_connect(int fd) { printf("connect\n"); }

void on_data(int fd) { printf("data\n"); }

void on_close(int fd) { printf("close\n"); }

int main() {
nsock(9999, on_connect, on_data, on_close);
return 0;
}