Added code for testing
This commit is contained in:
10
easysock.c
10
easysock.c
@@ -89,7 +89,6 @@ int create_remote (int network,char transport,char* address,int port,struct sock
|
||||
|
||||
|
||||
memset(&hints,'\0',sizeof(hints));
|
||||
// hints.ai_family = int_to_inet(network); /* AF_INET if network is 4, AF_INET6 if it is 6 */
|
||||
hints.ai_socktype = char_to_socktype(transport);
|
||||
|
||||
err_code = getaddrinfo(address,port_str,&hints,&results);
|
||||
@@ -106,10 +105,11 @@ int create_remote (int network,char transport,char* address,int port,struct sock
|
||||
if (socket < 0) {
|
||||
exit(errno);
|
||||
}
|
||||
unsigned char ip[100]= "";
|
||||
|
||||
inet_ntop(int_to_inet(network), &results->ai_addr->sa_data[2], ip, sizeof(ip));
|
||||
printf ("IP address: %s\n\n", ip);
|
||||
unsigned char ip[INET_ADDRSTRLEN];
|
||||
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)remote_addr_struct;
|
||||
memcpy(ip, in6->sin6_addr.s6_addr, 16);
|
||||
char ip_str[254];
|
||||
printf("%s\n",inet_ntop(AF_INET6,ip,ip_str,254));
|
||||
|
||||
|
||||
int addrlen;
|
||||
|
Reference in New Issue
Block a user