summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-12-04 13:01:57 +0100
committerxengineering <me@xengineering.eu>2022-12-04 13:01:57 +0100
commita985fb91e9d559f2520633f962028b856631c020 (patch)
tree2db4d202622552253060a169acfebc742336fbd5
parent7162a1018ac8cd64adf85fd30295d662f847e9a8 (diff)
downloadlimox-a985fb91e9d559f2520633f962028b856631c020.tar
limox-a985fb91e9d559f2520633f962028b856631c020.tar.zst
limox-a985fb91e9d559f2520633f962028b856631c020.zip
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.
-rw-r--r--xmpp.c7
1 files changed, 7 insertions, 0 deletions
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");
+ }
}