views:

619

answers:

4

So, I'm working on some network programming in C, and it would seem that I am missing a bunch of standard C/C++ header files. For example, sys/socket.h is not there. A few otheres are missing too like netdb.h, and unistd.h. Is there a pack I need to install to get these on windows?

Thanks

+3  A: 

none of those are standard c or c++ headers. On windows, socket definitions are in winsock2.h

Evan Teran
+1  A: 

you probably won't find it because it is a commonly used linux header file. You can find it in linux-libc-dev, if you really want it.

John T
+4  A: 

All these headers are from POSIX, not ANSI C, or ISO C++. You won't find them in Windows without installing some sort of compatibility layer, like Cygwin, or porting your application to Windows API, or use some macros and wrappers to map similar functions (i.e. #define strtok_r strtok_s).

Alex B
+1  A: 

As others said, you're using the POSIX headers and definitions for Socket. Check out MSDN for the headers and structures that are defined on Windows: http://msdn.microsoft.com/en-us/library/ms740506.aspx. The calls are pretty much the same, but this will give you all the microsoft-specific syntax.

Jason Coco