From ff0aae89238f4d60267def24476e8b9f4cb596cf Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 19 Oct 2024 15:31:51 +0200 Subject: add serialization to file code --- server.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server.c') diff --git a/server.c b/server.c index 63784d1..675bfb7 100644 --- a/server.c +++ b/server.c @@ -15,12 +15,14 @@ // - max y for new messages and make them scroll // - check resize event // - asynchronously receive/send a message +// - fix receiving messages with arbitrary text length // TODO: send message to all other clients // - implement different rooms // - implement history // - implement tls +#include "common.h" #include "config.h" #include #include @@ -33,6 +35,8 @@ #define MAX_CONNECTIONS 5 #define FD_MAX MAX_CONNECTIONS + 1 +static const char *filename = "history.dat"; + enum { FD_SERVER = 0 }; int serverfd; @@ -156,7 +160,6 @@ int main(void) printf("Retransmitted message to client %d.\n", j); } - // // TODO: check if bytes are correct // FILE *f = fopen("srv_recv.bin", "wb"); // fwrite(&msg_recv, sizeof(struct message), 1, f); @@ -164,7 +167,6 @@ int main(void) // // printf("written %lu bytes to srv_recv.bin\n", sizeof(msg_recv)); // return 0; - } } -- cgit v1.2.3