代码拉取完成,页面将自动刷新
#ifdef _WIN32
# include <ws2tcpip.h>
# include <windows.h>
# define MSG_NOSIGNAL 0
# define socklen_t _i32
#else
# include <signal.h>
# include <sys/socket.h>
# include <sys/types.h>
# include <poll.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <arpa/inet.h>
# include <netdb.h>
# include <unistd.h>
# include <fcntl.h>
# include <errno.h>
# define SOCKET_ERROR -1
# define closesocket close
# define SOCKET int
# define Sleep(x) usleep(x*1000)
#endif
#if defined(__sun__) || defined(__APPLE__)
# define MSG_NOSIGNAL 0
#endif
#ifdef SOCK_CLOEXEC
#ifndef VERSION
#include "config.h"
#endif
#ifdef HAVE_ACCEPT4
#define ACCEPT_CLOEXEC(sockfd, addr, addrlen) accept4_fb(sockfd, addr, addrlen, SOCK_CLOEXEC)
#else
#define EMULATE_ACCEPT_CLOEXEC
#endif
#else
#ifdef _WIN32
#define ACCEPT_CLOEXEC(sockfd, addr, addrlen) accept(sockfd, addr, addrlen)
#else
#define EMULATE_ACCEPT_CLOEXEC
#endif //!_WIN32
#endif //!SOCK_CLOEXEC
#ifdef EMULATE_ACCEPT_CLOEXEC
#ifndef ACCEPT_CLOEXEC_DEFINED
#define ACCEPT_CLOEXEC_DEFINED
namespace {
int ACCEPT_CLOEXEC(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
int rc = accept(sockfd, addr, addrlen);
if (rc) fcntl(rc, F_SETFD, fcntl(rc, F_GETFD, 0) | FD_CLOEXEC);
return rc;
}
}
#endif //ACCEPT_CLOEXEC_DEFINED
#endif //EMULATE_ACCEPT_CLOEXEC
#if !defined(EMULATE_ACCEPT_CLOEXEC) && defined(SOCK_CLOEXEC) && defined(HAVE_ACCEPT4) && !defined(ACCEPT_FB_DEFINED)
#define ACCEPT_FB_DEFINED
namespace {
int accept4_fb(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
{
int rc = accept4(sockfd, addr, addrlen, flags);
if (rc == -1 && errno == EINVAL)
{
rc = accept(sockfd, addr, addrlen);
if (rc) fcntl(rc, F_SETFD, fcntl(rc, F_GETFD, 0) | FD_CLOEXEC);
}
return rc;
}
}
#endif
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。