#include <folly/FileUtil.h>
#include <cerrno>
-#include <sys/socket.h>
#include <folly/detail/FileUtilDetail.h>
#include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/SysFile.h>
namespace folly {
#pragma once
#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netdb.h>
#include <cstddef>
#include <iostream>
#include <string>
#include <folly/IPAddress.h>
#include <folly/Portability.h>
#include <folly/Range.h>
+#include <folly/portability/Sockets.h>
namespace folly {
#include <sys/prctl.h>
#endif
#include <fcntl.h>
-#include <poll.h>
#include <array>
#include <algorithm>
#include <folly/String.h>
#include <folly/io/Cursor.h>
#include <folly/portability/Environment.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
constexpr int kExecFailure = 127;
#include <sstream>
#include <type_traits>
#include <vector>
-
-extern "C" {
-#ifndef _MSC_VER
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#else
-#include <winsock2.h>
-#include <ws2tcpip.h>
-// missing in socket headers
-#define sa_family_t ADDRESS_FAMILY
-#endif
-
#include <sys/types.h>
-#include <netdb.h>
-}
#include <folly/Conv.h>
#include <folly/Format.h>
+#include <folly/portability/Sockets.h>
// BSDish platforms don't provide standard access to s6_addr16
#ifndef s6_addr16
#pragma once
-#include <sys/socket.h>
+#include <folly/portability/Sockets.h>
#include <sys/types.h>
#if !defined(FOLLY_ALLOW_TFO) && defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN)
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
-#include <poll.h>
#include <cstdlib>
#include <cstdio>
#include <folly/experimental/io/FsUtil.h>
#include <folly/ScopeGuard.h>
#include <folly/String.h>
+#include <folly/portability/Sockets.h>
namespace fs = folly::fs;
using folly::AsyncIO;
#include <folly/io/ShutdownSocketSet.h>
-#include <sys/socket.h>
#include <sys/types.h>
#include <chrono>
#include <folly/FileUtil.h>
#include <folly/Malloc.h>
+#include <folly/portability/Sockets.h>
namespace folly {
#include <folly/io/async/AsyncSSLSocket.h>
#include <folly/io/async/EventBase.h>
+#include <folly/portability/Sockets.h>
#include <boost/noncopyable.hpp>
#include <errno.h>
#include <fcntl.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
#include <openssl/err.h>
#include <openssl/asn1.h>
#include <openssl/ssl.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <chrono>
#include <folly/Bits.h>
#pragma once
-#include <arpa/inet.h>
#include <iomanip>
#include <folly/Optional.h>
#include <folly/Bits.h>
#include <folly/io/IOBuf.h>
#include <folly/io/Cursor.h>
+#include <folly/portability/Sockets.h>
namespace folly {
#include <folly/io/async/EventBase.h>
#include <folly/io/async/NotificationQueue.h>
#include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <errno.h>
-#include <netinet/tcp.h>
#include <string.h>
-#include <sys/socket.h>
#include <sys/types.h>
namespace folly {
#include <folly/io/async/EventBase.h>
#include <folly/io/async/EventHandler.h>
#include <folly/io/async/NotificationQueue.h>
+#include <folly/portability/Sockets.h>
+
#include <limits.h>
#include <stddef.h>
-#include <sys/socket.h>
#include <exception>
#include <memory>
#include <vector>
#include <folly/SocketAddress.h>
#include <folly/io/IOBuf.h>
#include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/SysUio.h>
#include <folly/portability/Unistd.h>
-#include <poll.h>
#include <errno.h>
#include <limits.h>
#include <thread>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
#include <boost/preprocessor/control/if.hpp>
using std::string;
#include <folly/io/async/AsyncTransport.h>
#include <folly/io/async/DelayedDestruction.h>
#include <folly/io/async/EventHandler.h>
-#include <sys/socket.h>
+#include <folly/portability/Sockets.h>
+
#include <sys/types.h>
#include <chrono>
#include <folly/io/async/EventBase.h>
#include <folly/Likely.h>
#include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <errno.h>
#pragma once
-#include <poll.h>
#include <sys/types.h>
#include <algorithm>
#include <folly/ScopeGuard.h>
#include <folly/SpinLock.h>
#include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <glog/logging.h>
#include <string>
#include <random>
+// This has to come before SSL.
+#include <folly/portability/Sockets.h>
+
#include <openssl/ssl.h>
#include <openssl/tls1.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
#include <glog/logging.h>
#ifndef FOLLY_NO_CONFIG
*/
#include <folly/io/async/ssl/OpenSSLUtils.h>
#include <folly/ScopeGuard.h>
+#include <folly/portability/Sockets.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
#include <glog/logging.h>
namespace folly {
*/
#pragma once
-#include <openssl/x509v3.h>
+#include <folly/portability/Sockets.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
+#include <openssl/x509v3.h>
namespace folly {
namespace ssl {
#include <folly/io/async/AsyncSSLSocket.h>
#include <folly/io/async/EventBase.h>
#include <folly/SocketAddress.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <folly/io/async/test/BlockingSocket.h>
#include <set>
#include <fcntl.h>
#include <openssl/bio.h>
-#include <poll.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
#include <folly/io/Cursor.h>
using std::string;
#include <folly/io/async/AsyncTransport.h>
#include <folly/io/async/EventBase.h>
#include <folly/io/async/ssl/SSLErrors.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <gtest/gtest.h>
#include <iostream>
#include <list>
#include <fcntl.h>
-#include <poll.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
namespace folly {
#include <folly/io/async/AsyncSocket.h>
#include <folly/io/async/test/BlockingSocket.h>
+#include <folly/portability/Sockets.h>
#include <boost/scoped_array.hpp>
-#include <poll.h>
enum StateEnum {
STATE_WAITING,
#include <folly/io/IOBuf.h>
#include <folly/io/async/test/AsyncSocketTest.h>
#include <folly/io/async/test/Util.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <folly/test/SocketAddressTestHelper.h>
#include <boost/scoped_array.hpp>
#include <iostream>
#include <fcntl.h>
-#include <poll.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
#include <thread>
using namespace boost;
#include <folly/io/async/test/SocketPair.h>
#include <folly/Conv.h>
+#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <stdexcept>
namespace folly {
#include <chrono>
#include <thread>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/socket.h>
-
#include <glog/logging.h>
#include <gtest/gtest.h>
+#include <folly/portability/Sockets.h>
+
using folly::ShutdownSocketSet;
namespace folly { namespace test {
#include <gtest/gtest.h>
-extern "C" {
#include <sys/types.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-}
#include <folly/IPAddress.h>
+#include <folly/portability/Sockets.h>
namespace folly {
#include <folly/test/SocketAddressTestHelper.h>
-#include <sys/socket.h>
-#include <netdb.h>
+#include <folly/portability/Sockets.h>
#include <glog/logging.h>
namespace folly {