|
Hi!
I'd like to contribute some error descriptions for
System.ComponentModel.Win32Exception.cs
(included in patch1.txt)
I'd also like to contribute a small PERL utility
"update_win32_errors.pl" that, when executed at the top level of source code
(which is below mono and mcs and gtk-sharp) will
scan through all "*.c" source files in mono looking for WSASetLastError(...) and
SetLastError(...) calls and for all errors that are not handled in
Win32Exception.cs it will generate the appropriate source code to
stdout.
The code needs to be pasted into Win32Exception.cs
and error codes need to be replaced with their descriptions.
I'm also sending a patch to sockets.c to check
for bind() EADDRINUSE error (Address already in use, perhaps the most
common bind() error) (patch2.txt)
BTW. I'm not sure if all error texts should be in
"Win32Exception.cs" instead of "SocketException.cs", but it's very easy to
fix.
Regards,
Jarek
|
Index: Win32Exception.cs
===================================================================
RCS file: /mono/mcs/class/System/System.ComponentModel/Win32Exception.cs,v
retrieving revision 1.3
diff -u -r1.3 Win32Exception.cs
--- Win32Exception.cs 27 Apr 2002 18:52:58 -0000 1.3
+++ Win32Exception.cs 14 May 2002 06:28:49 -0000
@@ -72,6 +72,37 @@
Locale.GetText("proto no supported"));
w32_errors.Add(10044,
Locale.GetText("socket not supproted"));
+ w32_errors.Add(10004,
+ Locale.GetText("interrupted"));
+
+ w32_errors.Add(10013,
+ Locale.GetText("Access denied"));
+ w32_errors.Add(11002,
+ Locale.GetText("A temporary error occurred on an
+authoritative name server. Try again later."));
+ w32_errors.Add(10022,
+ Locale.GetText("Invalid arguments"));
+ w32_errors.Add(10050,
+ Locale.GetText("Network subsystem is down"));
+ w32_errors.Add(10051,
+ Locale.GetText("Network is unreachable"));
+ w32_errors.Add(10061,
+ Locale.GetText("Connection refused"));
+ w32_errors.Add(10045,
+ Locale.GetText("Operation not supported"));
+ w32_errors.Add(10038,
+ Locale.GetText("The descriptor is not a socket"));
+ w32_errors.Add(10055,
+ Locale.GetText("Not enough buffer space is available"));
+ w32_errors.Add(10056,
+ Locale.GetText("Socket is already connected"));
+ w32_errors.Add(10048,
+ Locale.GetText("Address already in use"));
+ w32_errors.Add(10057,
+ Locale.GetText("The socket is not connected"));
+ w32_errors.Add(10058,
+ Locale.GetText("The socket has been shut down"));
+ w32_errors.Add(10093,
+ Locale.GetText("Winsock not initialized"));
}
private static string W32ErrorMessage(int error_code) {
update_win32_errors.pl
Description: Perl programIndex: sockets.c =================================================================== RCS file: /mono/mono/mono/io-layer/sockets.c,v retrieving revision 1.10 diff -u -r1.10 sockets.c --- sockets.c 9 May 2002 13:10:18 -0000 1.10 +++ sockets.c 14 May 2002 06:36:11 -0000 @@ -348,6 +348,11 @@ case EFAULT: WSASetLastError(WSAEFAULT); break; + + case EADDRINUSE: + WSASetLastError(WSAEADDRINUSE); + break; + case EROFS: case ENAMETOOLONG: case ENOENT:
