21 lines
474 B
C
Raw Normal View History

2025-03-16 05:49:29 +01:00
// 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
2025-01-14 18:53:15 +01:00
#include "nsock.h"
void on_connect(int fd) { printf("connect\n"); }
2025-03-16 05:49:29 +01:00
2025-01-14 18:53:15 +01:00
void on_data(int fd) { printf("data\n"); }
2025-03-16 05:49:29 +01:00
2025-01-14 18:53:15 +01:00
void on_close(int fd) { printf("close\n"); }
int main() {
nsock(9999, on_connect, on_data, on_close);
return 0;
}