From b7314a68d87acf30930417e5f0fdcd9115c6a3d6 Mon Sep 17 00:00:00 2001
From: Doug Coleman <doug.coleman@gmail.com>
Date: Fri, 26 Aug 2011 11:03:01 -0500
Subject: [PATCH] Try to read instead of write from a TCP connection. This
 gives 'Connection refused' instead of 'Broken pipe', which is much more
 useful.

---
 basis/io/sockets/unix/unix.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/basis/io/sockets/unix/unix.factor b/basis/io/sockets/unix/unix.factor
index 3f91c0e8b6..fbfff5e9eb 100644
--- a/basis/io/sockets/unix/unix.factor
+++ b/basis/io/sockets/unix/unix.factor
@@ -50,7 +50,7 @@ M: object (get-remote-address) ( handle local -- sockaddr )
     SOL_SOCKET SO_OOBINLINE set-socket-option ;
 
 : wait-to-connect ( port -- )
-    dup handle>> handle-fd f 0 write
+    dup handle>> handle-fd f 0 read
     {
         { [ 0 = ] [ drop ] }
         { [ errno EAGAIN = ] [ dup +output+ wait-for-port wait-to-connect ] }