# HG changeset patch # User MrJuneJune # Date 1764823910 28800 # Node ID ac8626c7859cc573db0854b54de02a0996ed3fef # Parent 0cfd7d9277b0f87130aeb2b3e604af5f70308284 [Gara] Re-writing basic logic in C and hoping that I can import that into Java. diff -r 0cfd7d9277b0 -r ac8626c7859c gara/BUILD --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gara/BUILD Wed Dec 03 20:51:50 2025 -0800 @@ -0,0 +1,9 @@ +load("@rules_cc//cc:cc_binary.bzl", "cc_binary") + +cc_binary( + name = "gara_c", + srcs = ["main.c"], + deps = ["//seobeo:seobeo"], +) + + diff -r 0cfd7d9277b0 -r ac8626c7859c gara/main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gara/main.c Wed Dec 03 20:51:50 2025 -0800 @@ -0,0 +1,42 @@ +#include "seobeo/seobeo.h" +#include "stdio.h" + +void HandleClientRequest(Seobeo_PHandle 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_PHandle server = Seobeo_Stream_Handle_Server_Create(NULL, PORT); + + printf("Server running\n"); + while (1) + { + Seobeo_PHandle 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; +}