Move socket error handling code to an own module and also use pretty error messages in the Win32 driver.