nobu.nokada / softhome.net wrote:

> Although it's ad hoc, what about treating EINVAL preceded by
> EINPROGRESS as ECONNREFUSED?

Hi:

It seemed to work: many thanks!

Attached is yor patch, modified to use __APPLE__. I'm nervous about 
committing this myself, so I thought I'd let wiser minds look at it again.

Cheers


Dave



Index: ext/socket/socket.c
===================================================================
RCS file: /src/ruby/ext/socket/socket.c,v
retrieving revision 1.92
diff -u -r1.92 socket.c
--- ext/socket/socket.c 7 Apr 2003 06:58:31 -0000       1.92
+++ ext/socket/socket.c 16 May 2003 02:18:41 -0000
@@ -733,7 +733,7 @@
  {
      int status;
      int mode;
-#if defined __CYGWIN__
+#if defined __CYGWIN__ || defined __APPLE__
      int wait_in_progress = -1;
  #endif

@@ -774,19 +774,27 @@
               case EALREADY:
                 wait_in_progress = 10;
  #endif
+#ifdef __APPLE__
+               wait_in_progress = 1;
+#endif
  #endif
                 thread_write_select(fd);
                 continue;

-#if defined __CYGWIN__
               case EINVAL:
+#if defined __CYGWIN__
                 if (wait_in_progress-- > 0) {
                     struct timeval tv = {0, 100000};
                     rb_thread_wait_for(tv);
                     continue;
                 }
-               break;
  #endif
+#if defined __APPLE__
+               if (wait_in_progress > 0) {
+                   errno = ECONNREFUSED;
+               }
+#endif
+               break;

  #ifdef EISCONN
               case EISCONN: