What’s the recommended way of handling Winsock errors in C++?
Checking the return code of every Winsock function you call in your application?
Or
Handling errors through exception handling (something like
SocketException : public std::exception)?
Or
Both?
Since Winsock itself doesn’t throw exceptions, the only way to handle errors is to check the return code of functions you call.
If you write your own layer on top of Winsock that throws your own exceptions, then your application code could respond to exceptions. But that’s up to you.