In Chapter 5, Delving into the Boost.Asio Library, we discussed handling exception and error. If we follow all the source code in this book, we may never get any error code to confuse us. However, if we try to modify the source code, even just a little, an error code may be thrown for which the program will not give us any description. Since the error code thrown by the Boost
library is based on Windows system error code and is beyond the scope of this book, we can find the description on Microsoft Developer Network (MSDN) website at msdn.microsoft.com/en-us/library/windows/desktop/ms681381%28v=vs.85%29.aspx. Here, we can find all translations of error codes from error 0 to 15999. Using GDB and error code translation from MSDN would become a powerful tool for solving an error that occurs in our program.
Let's go back to Chapter 6, Creating a Client-server Application and run the serverasync
program. When the program is run, it listens to the client in 127.0.0.1
on port 4444
, which will be simulated by telnet in our example. However, what will happen if the client is not responding? To know further, let's run the serverasync
program without running telnet. The following error will be displayed because the client is not responding:
We got the system error code 995
. Now, with this error code, we can visit MSDN System Error Codes and find the error description, which is The I/O operation has been aborted because of either a thread exit or an application request. (ERROR_OPERATION_ABORTED).