[system] - system_message and gai_strerror function

Hello, the system_message function is implemented with ::strerror. How to handle systems erros related like EAI_NONAME (host not found), EAI_MEMORY (allocation failure) etc.? This erros occure in the context of getaddrinfo (related to network address and service translation) and requier ::gai_strerror in system_message. regards, Oliver

Oliver.Kowalke@qimonda.com wrote:
the system_message function is implemented with ::strerror. How to handle systems erros related like EAI_NONAME (host not found), EAI_MEMORY (allocation failure) etc.? This erros occure in the context of getaddrinfo (related to network address and service translation) and requier ::gai_strerror in system_message.
And there's also the error EAI_SYSTEM, which means that the actual error value is to be found in errno instead. This is the issue I raised a while back, where I suggested that maybe we need support for implementation-defined error categories, or "errorspaces". I'm not sure what the best solution is, but it's a problem that needs to be solved for asio. I'm definitely in favour of having a single error_code type used across all system functions to allow the simpler composition of higher-level system operations. For example: - A connect_host/async_connect_host function as suggested by Cory would need to use a resolver (which raises getaddrinfo-sourced errors) followed by a socket (which raises errno errors). - A hypothetical transmit_file/async_transmit_file function could have errors resulting from filesystem access or from socket operations. There's also the problem of the error asio::error::eof, which corresponds to a real error on Windows, but is synthesised on POSIX platforms. Cheers, Chris
participants (2)
-
Christopher Kohlhoff
-
Oliver.Kowalke@qimonda.com