Porting Winsock to Linux Sockets

前端 未结 4 929
盖世英雄少女心
盖世英雄少女心 2021-01-11 15:56

I have a program that does some networking using Winsock, and one of our requirements right now is to port over our program to Linux. The only thing stopping us from doing t

4条回答
  •  既然无缘
    2021-01-11 16:54

    Based on that list of functions, things should more or less just work. Add #if _WIN32 around the calls to WSAStartup and WSACleanup (the linux equivalent is to not do anything, the sockets library is initialized automatically).

    You also might need some OS-dependent code when setting socket options, some of them are the same, some aren't, and the types might be different.

提交回复
热议问题