muduo icon indicating copy to clipboard operation
muduo copied to clipboard

[FIX] fix InetAddress compile, and use getaddrinfo instead of gethostbyname_r

Open Simonhancrew opened this issue 1 year ago • 1 comments

@chenshuo

cpp17, compile issue occurs

muduo/muduo/net/InetAddress.cc:50:35: error: expected primary-expression before ‘,’ token
   50 | static_assert(offsetof(sockaddr_in, sin_family) == 0, "sin_family offset 0");

my gcc version

gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And InetAddress::resolve use gethostbyname_r , maybe we should use getaddrinfo instead

Simonhancrew avatar May 31 '24 06:05 Simonhancrew

刘德聪,已经收到你的邮件,请你放心 祝你生活愉快,笑口常开

ggandycong avatar May 31 '24 06:05 ggandycong