Skip to content

Instantly share code, notes, and snippets.

View sumnjc's full-sized avatar

Yoo Joung Sik sumnjc

  • Korea
View GitHub Profile
@Gydo194
Gydo194 / Server.cpp
Last active May 21, 2024 08:18
C++ Event driven TCP socket server (multi client, single threaded)
/*
* Server.cpp
*
* EventServer is a simple C++ TCP socket server implementation,
* to serve as an example to anyone who wants to learn it.
* It can interface with the rest of your program using three callback functions.
* - onConnect, which fires when a new client connects. the client's fd is passed.
* - onDisconnect, which fires when a client disconnects. passes fd.
* - onInput, fires when input is received from a client. passes fd and char*
*