mirror of
https://github.com/Kiritow/GSock.git
synced 2024-03-22 13:10:51 +08:00
Fix inet_ntop wrong usage
This commit is contained in:
parent
8f95cb2f48
commit
fdea364bb8
|
@ -310,7 +310,7 @@ static int _sock_getname_call(int sfd,std::string& ip,int& port,_sock_getname_ca
|
||||||
{
|
{
|
||||||
struct sockaddr_in* paddr = &pack.saddr4;
|
struct sockaddr_in* paddr = &pack.saddr4;
|
||||||
char ip_buff[64] = { 0 };
|
char ip_buff[64] = { 0 };
|
||||||
const char* pret = inet_ntop(AF_INET, paddr, ip_buff, 64);
|
const char* pret = inet_ntop(AF_INET, &(paddr->sin_addr), ip_buff, 64);
|
||||||
if (pret)
|
if (pret)
|
||||||
{
|
{
|
||||||
ip = std::string(ip_buff);
|
ip = std::string(ip_buff);
|
||||||
|
@ -327,7 +327,7 @@ static int _sock_getname_call(int sfd,std::string& ip,int& port,_sock_getname_ca
|
||||||
{
|
{
|
||||||
struct sockaddr_in6* paddr = &pack.saddr6;
|
struct sockaddr_in6* paddr = &pack.saddr6;
|
||||||
char ip_buff[128] = { 0 };
|
char ip_buff[128] = { 0 };
|
||||||
const char* pret = inet_ntop(AF_INET6, paddr, ip_buff, 128);
|
const char* pret = inet_ntop(AF_INET6, &(paddr->sin6_addr), ip_buff, 128);
|
||||||
if (pret)
|
if (pret)
|
||||||
{
|
{
|
||||||
ip = std::string(ip_buff);
|
ip = std::string(ip_buff);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user