mirror of
https://github.com/opus-tango/http-server-in-c.git
synced 2026-03-20 03:55:25 +00:00
16 lines
378 B
C
16 lines
378 B
C
#include "client_handler.h"
|
|
|
|
#define BUFFER_SIZE 1024
|
|
|
|
void* client_handler(void* args) {
|
|
int client = *((int*)args);
|
|
char* buffer = (char*)malloc(BUFFER_SIZE);
|
|
|
|
ssize_t bytes_read = recv(client, buffer, BUFFER_SIZE, 0);
|
|
if (bytes_read > 0) {
|
|
buffer[bytes_read] = '\0';
|
|
printf("Received: %s\n", buffer);
|
|
}
|
|
free(buffer);
|
|
return NULL;
|
|
} |