From 7162a1018ac8cd64adf85fd30295d662f847e9a8 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 4 Dec 2022 12:57:01 +0100 Subject: Implement socket creation The socket is needed for the TCP connection to the XMPP server. --- xmpp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xmpp.c b/xmpp.c index 9db1574..c586e8b 100644 --- a/xmpp.c +++ b/xmpp.c @@ -115,5 +115,13 @@ void xmpp_connect(void) char *domain = get_domainpart(jid); printf("Domainpart is '%s'.\n", domain); - get_addrinfo(domain); + struct addrinfo *addr = get_addrinfo(domain); + + int sock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); + if (sock == -1) { + printf("Failed to get socket from OS!."); + return; + } else { + printf("Got socket number %d from OS.\n", sock); + } } -- cgit v1.2.3-70-g09d2