Moved 'check_ip_ver' function to easysock.c

Aadhavan Srinivasan 2 years ago committed by Rockingcool
parent ca83bd693b
commit 8e4d3d89de

@ -102,3 +102,15 @@ int create_remote (int network,char transport,char* address,int port,struct sock
} }
return socket; return socket;
} }
int check_ip_ver(char* address) {
char buffer[16]; /* 16 chars - 128 bits - is enough to hold an ipv6 address */
if (inet_pton(AF_INET,address,buffer) == 1) {
return 4;
} else if (inet_pton(AF_INET6,address,buffer) == 1) {
return 6;
} else {
return -1;
}
}

Loading…
Cancel
Save