Thanks for the suggestion. Yes, I did try 127.0.0.1, as well as the 
network IP address of the computer (192.168...); they both worked, but 
with about *twice* the delay.

I even recompiled Ruby 1.8.0 pre 3 after editing ext/socket/Makefile to 
disable IPv6, but that didn't change the delay at all.

I ran tcpflow to watch the loopback interface while I ran the DRb 
transaction, and there was a bunch of binary stuff with NIS keywords 
intermingled, and the ethernet interface was silent, so apparently the 
lookup is going through NetInfo (and eventually succeeding). I'm not 
sure what to poke at to learn more than this about where the delay is 
occuring.

To compare with a simple C program doing the same thing on the same 
computer, I just compiled & ran the code at 
<http://www.cs.wpi.edu/~cs3013/c03/week6-unixsock/week6-unixsock.html>, 
and it works great with no noticeable delay at all. The only thing I 
had to tweak to compile it was taking the #ifndef unix...#else & the 
#endif because apparently OS X doesn't define "unix". (I pasted the 
diff for my changes to the server code below.)

Anyone have an idea how to fix Ruby, or do further troubleshooting? 
This is a stock Mac box; it should just work, shouldn't it?

Please help!

On Monday, Jun 23, 2003, at 19:24 America/Chicago, Florian G. Pflug 
wrote:

> On Tue, Jun 24, 2003 at 04:58:09AM +0900, John Platte wrote:
>> I'm getting delays making TCP connections to "localhost" on our OS X
>> box.
>>
>>> irb(main):003:0> TCPSocket.open("localhost", 1234)
>
> Did you try using 127.0.0.1 instead of localhost? Maybe Roundevous 
> (included
> in OSX >= 10.1) tries to resolve localhost on the local network (using
> multicast dns), instead of looking it up in the netinfo database...

[john@mac ~/csock]$ diff -u sockserver-orig.c sockserver.c
--- sockserver-orig.c   Tue Jun 24 09:06:47 2003
+++ sockserver.c        Thu Jan  1 03:28:43 1970
@@ -1,17 +1,11 @@
  /* adapted from Sample 25_2 from "Computer Networks and Internets, 2nd 
ed by Comer */
  /* sockserver.c - code for example server program that uses TCP */

-#ifndef unix
-#define WIN32
-#include <windows.h>
-#include <winsock.h>
-#else
  #define closesocket close
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
  #include <netdb.h>
-#endif

  #include <stdio.h>
  #include <string.h>
[john@mac ~/csock]$

-- 
John Platte
Principal Consultant, NIKA Consulting
http://nikaconsulting.com/