From a985fb91e9d559f2520633f962028b856631c020 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 4 Dec 2022 13:01:57 +0100 Subject: Implement TCP connection to XMPP server This commit adds the functionality to actually connect to port 5222 (xmpp-client) of a XMPP server! This was tested using prosody and verified via its systemd journal log entries. --- xmpp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xmpp.c b/xmpp.c index c586e8b..240dfc1 100644 --- a/xmpp.c +++ b/xmpp.c @@ -124,4 +124,11 @@ void xmpp_connect(void) } else { printf("Got socket number %d from OS.\n", sock); } + + if (connect(sock, addr->ai_addr, addr->ai_addrlen) == -1) { + printf("Failed to connect!\n"); + return; + } else { + printf("Successfully connected.\n"); + } } -- cgit v1.2.3-70-g09d2