I was just trying to build netcat in MSYS using MinGW and realized that MinGW never really ported all of the BSD socket stuff to Windows (eg sys/socket.h). I know you can u
These comments from another answer served as the answer I needed to get a piece of simple bsd socket code to compile with mingw on windows.
Replace all of those includes with #include as that would be the equivalent header for winsock, then see what happens.
You will also need to link against ws2_32 and use WSAStartup/WSACleanup. Which might get you up and running.
EDIT:
I also ended up having to replace close
with shutdown
/ closesocket
and write
with send
.
The code compiled fine but didn't actually work without those additional changes.