From 9e2a44364bfae9a226e02fe7ddad032b16a1318f Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 4 Dec 2022 14:02:21 +0100 Subject: Implement printing of server response Sadly there is no way to stop LimoX after connection. This has to be fixed by a commit implementing a better control flow between GUI and network part of the program. --- xmpp.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/xmpp.c b/xmpp.c index 1546cdc..c574ba5 100644 --- a/xmpp.c +++ b/xmpp.c @@ -20,7 +20,9 @@ #define _GNU_SOURCE #include #include +#include #include +#include #include #include #include @@ -170,4 +172,19 @@ void xmpp_connect(void) return; } printf("Stream init sent.\n"); + + printf("This is the server response:\n"); + char buf; + while(1) { + int retval = recv(sock, (void *)&buf, 1, 0); + if (retval == 0) { + printf("Connection closed!\n"); + break; + } else if (retval == 1) { + write(1, (const void *)&buf, 1); + } else { + printf(strerror(errno)); + printf("Unhandled recv() return value %d!\n", retval); + } + } } -- cgit v1.2.3-70-g09d2