void ReportIOError(string optional_arg)
{
int error = Marshal.GetLastWin32Error ();
string message;
switch (error) {
case 2:
case 3:
message = "The port `" + optional_arg + "' does not exist.";
break;
case 87:
message = "Parameter is incorrect.";
break;
default:
// As fallback, we show the win32 error
message = new Win32Exception ().Message;
break;
}
throw new IOException (message);
}