Skip to content

Instantly share code, notes, and snippets.

@kunigami
Last active March 5, 2020 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/eda7d26031d01f80bc4203aa475ba3e4 to your computer and use it in GitHub Desktop.
Save kunigami/eda7d26031d01f80bc4203aa475ba3e4 to your computer and use it in GitHub Desktop.
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
// Important! Fill in my IP for me
hints.ai_flags = AI_PASSIVE;
// Use the address from localhost
getaddrinfo(NULL, "3490", &hints, &res);
sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
bind(sockfd, res->ai_addr, res->ai_addrlen);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment