- /*
- * getaddrinfoex1.c - GetAddrInfoExA() test
- *
- * Compile on cygwin 3.5.0 $ clang getaddrinfoex1.c -lws2_32 && ./a #
- *
- * Written by Roland Mainz <roland.mainz@nrubsig.org>
- */
- #define UNICODE 1
- #include <ws2tcpip.h>
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- struct addrinfoexA hints;
- struct addrinfoexA *result;
- int error;
- WORD wVersionRequested;
- WSADATA wsaData;
- int err;
- wVersionRequested = MAKEWORD(2, 2);
- err = WSAStartup(wVersionRequested, &wsaData);
- hints.ai_family = AF_INET6/*AF_UNSPEC*/;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = IPPROTO_TCP;
- error = GetAddrInfoExA("derfwpc5131_ipv6", "2049", 0, NULL, &hints, &result, NULL, NULL, NULL, NULL);
- if (error != 0) {
- }
- for (struct addrinfoexA *p = result; p != NULL; p = p->ai_next) {
- char host[NI_MAXHOST];
- char service[NI_MAXSERV];
- error = getnameinfo(p->ai_addr, p->ai_addrlen, host, NI_MAXHOST, service, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV);
- if (error != 0) {
- continue;
- }
- }
- // FreeAddrInfoEx(result);
- return 0;
- }
getaddrinfoex1.c - GetAddrInfoExA() test
Posted by Anonymous on Mon 6th Nov 2023 00:48
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.