Is there any benefit to using windows winsock API functions over BSD style socket functions?

Are there any advantages in Windows for using Winsock WSA functions over BSD style?

0
sockets winsock


source to share


4 answers


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.

+2


source to share


Only if you plan on deploying a legacy platform like Windows 95, or there is something about the winsock API that you absolutely can't live with and you don't want to rollback (<- dubious).



+2


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.

+1


source to share


Regarding Alnitak's answer, I agree - I would add that you don't need to use a message loop to use asynchronous operations on sockets. Using I / O completion ports is a very scalable way to create a high performance network application.

0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics