Sockets in MinGW

后端 未结 7 1298
猫巷女王i
猫巷女王i 2020-12-30 23:26

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

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 00:01

    WinSock and WinSock2 have different function names from the BSD Sockets. If I wish to write cross-platform applications, then I have code a lot of work-arounds just to keep Microsoft happy.

    It would be so much easier if there were special "socket.h" and "socket.c" files included with MinGW that simply translated stuff by calling the respective WinSock2 counter-parts.

    I'm just starting to learn C programming, so I'm unable to do this myself, but I'm surprised that nobody seems to have even attempted this so far.

提交回复
热议问题