summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmpp.c17
1 files changed, 17 insertions, 0 deletions
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 <stdlib.h>
#include <stdio.h>
+#include <errno.h>
#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -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);
+ }
+ }
}