我使用在Linux机器上使用socket用C语言搭建了一个服务器,它工作的很好,但是当我试图在Windows机器上使用Visual Studio运行时,出现了错误:
fatal error C1083:无法打开包括文件:'sys/socket.h':没有那个文件或目录
IDE告诉我找不到这些头文件。
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
sys/socket.h
文件。您可以从这里开始阅读Windows文档:https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-start-page-2 - SergeyAselect
)。只有当您深入研究(例如尝试将基于边缘触发的epoll
系统移植到 Windows)时,但是这种情况下,您所使用的互操作库可能一开始就没有支持此功能。 - SergeyA