tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: getaddrinfo(3) on numerical addresses



> At least inet_pton parses a numerical IPv4 addresses without any dots.
Despite the man page claiming so, it actually doesn't (on 6.1):

#include <stdio.h>
#include <arpa/inet.h>
#include <sys/socket.h>

int main(int argc, char *argv[]) {
	char buf[16];
	printf("%d\n", inet_pton(AF_INET, "1", buf));
	return 0;
}

outputs "0" for me (which means failure).


Home | Main Index | Thread Index | Old Index