aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-19 15:31:51 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-19 15:31:51 +0200
commitff0aae89238f4d60267def24476e8b9f4cb596cf (patch)
treed8a646d04c0e2617bf279b387e5d11960906d340 /server.c
parent104dabefd62952f2d892a2dcdfb5700d9379ac00 (diff)
add serialization to file code
Diffstat (limited to 'server.c')
-rw-r--r--server.c6
1 files changed, 4 insertions, 2 deletions
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 <arpa/inet.h>
#include <errno.h>
@@ -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;
-
}
}