Is there any benefit to using windows winsock API functions over BSD style socket functions?
The most significant difference is the availability of the asynchronous event APIs in Winsock.
With Berkeley sockets, every time you read
or write
, your application will "block" until the network is ready, which can render your application unresponsive (unless network I / O is being processed on another thread).
With the asynchronous interface, you can provide a callback function to be called as part of the normal Windows message loop each time data is received or when the transmit buffer is empty.
source to share
If you are developing the BSD paradigm, your code can run on other platforms with fewer porting operations. If you assume that your networking library will support asynchronous I / O (as Alnitak mentions), you have to do a lot more work if it gets out of your way.
Of course, if you're sure you'll never leave Microsoft's warm chest, feel free to drive into town.
source to share