Search code examples
csocketsclient-servermingw32

'sys/socket.h' in MingW32


I'm trying to compile my client server program with MingW32, but I'm getting the error:

no sys/socket.h

So the compilation was terminated.

How can I solve this problem?


Solution

  • That file does not exist on Windows - to use networking sockets, you'll have to use Winsock. Fortunately, it's very similar to UNIX's Berkeley sockets.

    If it saves you any time, I've written a thin socket wrapper that compiles on both Windows and *nix systems. You can find it here.