Skip to content

Commit

Permalink
compatible ipv6
Browse files Browse the repository at this point in the history
  • Loading branch information
lansefengxinzi committed Dec 6, 2016
1 parent 55085f5 commit 29a744c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Pod/Classes/pili-librtmp/rtmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,17 +760,16 @@ static int PILI_add_addr_info(PILI_RTMP *r, struct addrinfo *hints, struct addri
ret = FALSE;
}else{
if(((struct addrinfo *)*ai)->ai_family == AF_INET6){
struct sockaddr_in6 * addrIn6;
addrIn6 = (struct sockaddr_in6 *)((struct addrinfo *)*ai)->ai_addr;
char ipbuf[40];
const char * remote_ip = inet_ntop(AF_INET6,&addrIn6->sin6_addr, ipbuf, sizeof(ipbuf));
strncat(remoteip, remote_ip, strlen(remote_ip));
}else{
struct sockaddr_in *addr;
addr = (struct sockaddr_in *)((struct addrinfo *)*ai)->ai_addr;
char ipbuf[16];
const char * remote_ip = inet_ntop(AF_INET6,&addr->sin_addr, ipbuf, sizeof(ipbuf));
strncat(remoteip, remote_ip, strlen(remote_ip));

}else{
struct sockaddr_in6 * addrIn6;
addrIn6 = (struct sockaddr_in6 *)((struct addrinfo *)*ai)->ai_addr;
char ipbuf[32];
const char * remote_ip = inet_ntop(AF_INET,&addrIn6->sin6_addr, ipbuf, sizeof(ipbuf));
const char * remote_ip = inet_ntop(AF_INET,&addr->sin_addr, ipbuf, sizeof(ipbuf));
strncat(remoteip, remote_ip, strlen(remote_ip));

}
Expand Down

0 comments on commit 29a744c

Please sign in to comment.