你要用netdb.h,无非就是想用里面的函数,所以与其说用netdb.h,不如说在Windows下找对应的函数。
拿gethostbyname来说,巧了,Windows就有这个函数:https://msdn.microsoft.com/en-us/library/windows/desktop/ms738524(v=vs.85).aspx
Requirements
Minimum supported client
Windows 8.1, Windows Vista [desktop apps | Windows Store apps]
Minimum supported server
Windows Server 2003 [desktop apps | Windows Store apps]
Minimum supported phone
Windows Phone 8
Header
Winsock2.h
Library
Ws2_32.lib
DLL
Ws2_32.dll