summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-12-04 12:57:01 +0100
committerxengineering <me@xengineering.eu>2022-12-04 12:57:01 +0100
commit7162a1018ac8cd64adf85fd30295d662f847e9a8 (patch)
treeaea4262d8cfc667ff25ede94abca7509c9c5ad06
parent0de21ec65f3c28f2acc947c00c3cb26dc9ea4ecd (diff)
downloadlimox-7162a1018ac8cd64adf85fd30295d662f847e9a8.tar
limox-7162a1018ac8cd64adf85fd30295d662f847e9a8.tar.zst
limox-7162a1018ac8cd64adf85fd30295d662f847e9a8.zip
Implement socket creation
The socket is needed for the TCP connection to the XMPP server.
-rw-r--r--xmpp.c10
1 files changed, 9 insertions, 1 deletions
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);
+ }
}