Can't create socket on Windows

后端 未结 3 1616
猫巷女王i
猫巷女王i 2021-02-15 12:53

I have quite an embarrassing problem. The following code simply will not create a socket on Windows; it fails and displays the error message. Could anyone briefly explain why th

3条回答
  •  醉梦人生
    2021-02-15 13:23

    You need to call WSAStartup() before any other socket functions will work on Windows (and you're supposed to call WSACleanup() when you're done).

提交回复
热议问题