From: "Bernard Delmée" Date: 2003-08-27T05:08:42+09:00 Subject: Re: [BUG] Incorrect TCPSocket errors > However, with ruby 1.8.0, I get error 61: "The printer queue is full" > This is obviously incorrect. It seems that 10000 has been subtracted > from the error number for some strange reason. That's not stange at all, but very well documented. If I recall correctly from way back when I was programming at C level under 16-bits windows, the winsock API tries to use error codes similar to the BSD ones, except it adds this 10000 offset. from "winsok.h": /* * All Windows Sockets error constants are biased by WSABASEERR from * the "normal" */ #define WSABASEERR 10000 .... #define WSAECONNREFUSED (WSABASEERR+61) I suppose the C module which implements socket support for ruby subtracts 10000, so that (literal) error codes are the same under unix and windows. Unfortunately, this code rather than the original one is also fed to the routine which converts windows API error codes to plain messages, resulting in the nonsense you're seeing. Indeed, looking at win32.c (from ruby 1.8.0): errno = WSAGetLastError() - WSABASEERR; repeated every time a winsock call fails. This is numerically reasonable, but also explains the incorrect error message. Maybe plain strerror() from the C stdlib is used to get the error string, but under windows where (native) file handles and sockets are not completely unified, this fails. I am afraid a clean solution - as opposed to a kludgy workaround - will require a bit of C surgery. Hoping this makes things clearer, Bernard. PS: one thing I'd be curious to know: was the error message actually correct under older ruby releases?