Sign in to follow this  

Question about winsock versions

This topic is 4742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi forum, Im making a winsock wrapper library that will provide two simple interface classes. 1) A client socket for client to connect to a server and 2) a Server socket to listen for clients connecting to it. I was wondering what version 2.0 of winsock has over version 1.1. Right now Im using Version 1.1 in developing this wrapper, but I wanted to know: 1. Is version 2.0 widely supported and in wat versions of window would it not be if not? 2. Is version 2.0 faster, more reliable, offer more functions? Bare in mind, my wrapper serves only to encapsulate winsock programming to make it easy for others who dont wanna deal with Winsock directly, so it provides a clean interface, just to allow developer to connect, send and recieve primitive data types (no objects) and close connection, thats all.. With that description of its use said, is it worth me implementing it in a version higher than 1.1? Im very new to Winsock by the way, so I dont know much about these things. Thanks in Advance DarkStar UK

Share this post


Link to post
Share on other sites
It's fairly difficult to find a computer that doesn't support Winsock 2.0 right now. IIRC, Winsock 2.0 has shipped standard with every Windows version since Win95 OSR 2.

Winsock 2 offers more functions than Winsock 1.1, and adds a few more options like more Ioctl flags. In terms of increased functionality, the biggies are better protocol independence (not really important if your wrapper is only for TCP/IP), some nice helper functions (like WSAStringToAddress() and WSAAddressToString()), overlapped I/O support and better multithreading support.

Share this post


Link to post
Share on other sites
It's likely that anything you'll be running on today supports WinSock 2. WinSock 2 fixes a bunch of bugs in version 1, so you really want to be using that.

Also: beware that you have to #include <winsock2.h> BEFORE you #include <windows.h>; <windows.h> otherwise tries to include the WinSock 1 header and symbol conflicts ensue.

That being said, there's tons of sockets wrappers already out there -- do you really need to write your own? If you want to learn, then that's all well and good, but if your goal is only to get stuff done, get an existing, debugged wrapper instead (check the Forum FAQ for a list).

Share this post


Link to post
Share on other sites

This topic is 4742 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this