Mercurial
view gara/main.c @ 149:f41ac17926d2
[Config] Added ctags scripts and actual tags.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Sat, 10 Jan 2026 07:07:10 -0800 |
| parents | 19cccf6e866a |
| children |
line wrap: on
line source
#include "seobeo/seobeo.h" #include "stdio.h" void HandleClientRequest(Seobeo_Handle *p_cli_handle) { char *hello = "Hello good sir"; Seobeo_Handle_Queue(p_cli_handle, (uint8_t*)hello, 14); Seobeo_Handle_Flush(p_cli_handle); while (1) { int n = Seobeo_Handle_Read(p_cli_handle); if (n > 0) { printf(p_cli_handle->read_buffer); Seobeo_Handle_Consume(p_cli_handle, n); } } } int main() { printf("Server initializing\n"); const char *PORT = "3322"; Seobeo_Handle *server = Seobeo_Stream_Handle_Server_Create(NULL, PORT); printf("Server running\n"); while (1) { Seobeo_Handle *p_cli_handle = Seobeo_Stream_Handle_Server_Accept(server); if (!p_cli_handle) continue; if (fork() == 0) { HandleClientRequest(p_cli_handle); _exit(0); } } return 0; }