From 6f4769855e36c5b0429535366b405e0489a2ac67 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Mon, 2 Oct 2017 14:22:37 +1000 Subject: [PATCH] Add ping pong to magichat server --- utils/magichat/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/magichat/main.c b/utils/magichat/main.c index 842d8b3..f065a98 100644 --- a/utils/magichat/main.c +++ b/utils/magichat/main.c @@ -248,6 +248,11 @@ int main(int argc, char **argv) { } } } + } else if (strcmp(msg.msg, "PING") == 0) { + snprintf(buffer, 1024, "{\"bbs\": \"SYSTEM\", \"nick\": \"SYSTEM\", \"msg\": \"PONG\" }\n"); + if (send(i, buffer, strlen(buffer), 0) == -1) { + perror("send"); + } } else { for (j=0;jfd == i) {