本文介绍了为什么有socket(),connect(),send()等的WSA吊坠,但不是为closesocket()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将尝试使用几个示例解释我的意思:




  • socket() - > WSASocket / li>
  • connect() - > WSAConnect()

  • send() - > WSASend()

  • sendto ) - > WSASendTo()

  • recv() - > WSARecv()

  • recvfrom() - > WSARecvFrom()

  • ...

  • closesocket() - > WSA ???()

解决方案

仅在Windows上可用,我不是肯定为什么他们不遵循那里的WSA约定。如果它真的打扰你,虽然你可以做自己的wrapper调用closesocket。



如应该调用closesocket。


I'm going to try to explain what I mean using a few examples:

  • socket() -> WSASocket()
  • connect() -> WSAConnect()
  • send() -> WSASend()
  • sendto() -> WSASendTo()
  • recv() -> WSARecv()
  • recvfrom() -> WSARecvFrom()
  • ...
  • closesocket() -> WSA???()

This is nothing that matters much, but is still something that gives me a splitting headache.

解决方案

closesocket is only available on Windows, I'm not sure why they didn't follow the WSA convention there though. If it really bothers you though you can make your own wrapper that calls closesocket.

As mentioned in WSASocket a call to closesocket should be made.

这篇关于为什么有socket(),connect(),send()等的WSA吊坠,但不是为closesocket()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 18:56