=== modified file 'src/ca/repeater.cpp'
--- src/ca/repeater.cpp	2013-05-16 18:33:31 +0000
+++ src/ca/repeater.cpp	2015-02-10 20:12:45 +0000
@@ -108,7 +108,7 @@
 /*
  * makeSocket()
  */
-static bool makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock )
+static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock )
 {
     int status;
 	union {
@@ -118,7 +118,7 @@
 
     SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 );     
     if ( sock == INVALID_SOCKET ) {
-        return false;
+        return SOCKERRNO;
     }
 
     /*
@@ -132,15 +132,16 @@
         bd.ia.sin_port = htons ( port );  
         status = bind ( sock, &bd.sa, (int) sizeof(bd) );
         if ( status < 0 ) {
+            status = SOCKERRNO;
             epicsSocketDestroy ( sock );
-            return false;
+            return status;
         }
         if ( reuseAddr ) {
             epicsSocketEnableAddressReuseDuringTimeWaitState ( sock );
         }
     }
     *pSock = sock;
-    return true;
+    return 0;
 }
 
 repeaterClient::repeaterClient ( const osiSockAddr &fromIn ) :
@@ -156,10 +157,10 @@
 {
     int status;
 
-    if ( ! makeSocket ( PORT_ANY, false, & this->sock ) ) {
+    if ( int sockerrno = makeSocket ( PORT_ANY, false, & this->sock ) ) {
         char sockErrBuf[64];
-        epicsSocketConvertErrnoToString ( 
-            sockErrBuf, sizeof ( sockErrBuf ) );
+        epicsSocketConvertErrorToString ( 
+            sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
         fprintf ( stderr, "%s: no client sock because \"%s\"\n",
                 __FILE__, sockErrBuf );
         return false;
@@ -300,20 +301,20 @@
 bool repeaterClient::verify ()
 {
     SOCKET tmpSock;
-    bool success = makeSocket ( this->port (), false, & tmpSock );
-    if ( success ) {
+    int sockerrno = makeSocket ( this->port (), false, & tmpSock );
+    if ( sockerrno == 0 ) {
         epicsSocketDestroy ( tmpSock );
     }
     else {
-        if ( SOCKERRNO != SOCK_EADDRINUSE ) {
+        if ( sockerrno != SOCK_EADDRINUSE ) {
             char sockErrBuf[64];
-            epicsSocketConvertErrnoToString ( 
-                sockErrBuf, sizeof ( sockErrBuf ) );
+            epicsSocketConvertErrorToString (
+                sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
             fprintf ( stderr, "CA Repeater: bind test err was \"%s\"\n", 
                 sockErrBuf );
         }
     }
-    return ! success;
+    return !!sockerrno; /* No socket errors => verification failed */
 }
 
 
@@ -387,10 +388,10 @@
 
         if ( ! init ) {
             SOCKET sock;
-            if ( ! makeSocket ( PORT_ANY, true, & sock ) ) {
+            if ( int sockerrno = makeSocket ( PORT_ANY, true, & sock ) ) {
                 char sockErrBuf[64];
-                epicsSocketConvertErrnoToString ( 
-                    sockErrBuf, sizeof ( sockErrBuf ) );
+                epicsSocketConvertErrorToString ( 
+                    sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
                 fprintf ( stderr, "%s: Unable to create repeater bind test socket because \"%s\"\n",
                     __FILE__, sockErrBuf );
             }
@@ -511,18 +512,18 @@
 
     port = envGetInetPortConfigParam ( & EPICS_CA_REPEATER_PORT,
                                        static_cast <unsigned short> (CA_REPEATER_PORT) );
-    if ( ! makeSocket ( port, true, & sock ) ) {
+    if ( int sockerrno = makeSocket ( port, true, & sock ) ) {
         /*
          * test for server was already started
          */
-        if ( SOCKERRNO == SOCK_EADDRINUSE ) {
+        if ( sockerrno == SOCK_EADDRINUSE ) {
             osiSockRelease ();
             debugPrintf ( ( "CA Repeater: exiting because a repeater is already running\n" ) );
             return;
         }
         char sockErrBuf[64];
-        epicsSocketConvertErrnoToString ( 
-            sockErrBuf, sizeof ( sockErrBuf ) );
+        epicsSocketConvertErrorToString ( 
+            sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
         fprintf ( stderr, "%s: Unable to create repeater socket because \"%s\" - fatal\n",
             __FILE__, sockErrBuf );
         osiSockRelease ();

=== modified file 'src/libCom/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp'
--- src/libCom/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp	2010-10-05 19:27:37 +0000
+++ src/libCom/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp	2015-02-10 20:18:16 +0000
@@ -20,16 +20,15 @@
 #include "epicsStdio.h"
 
 /*
- * epicsSocketConvertErrnoToString ()
+ * epicsSocketConvertErrorToString ()
  */
-void epicsSocketConvertErrnoToString ( 
-        char * pBuf, unsigned bufSize )
+void epicsSocketConvertErrorToString (
+        char * pBuf, unsigned bufSize, int theSockError )
 {
     if ( bufSize ) {
 	    /*
 	     * this does not work on systems prior to W2K
 	     */
-        int theSockError = SOCKERRNO;
 	    DWORD success = FormatMessage ( 
 		    FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK,
 		    NULL, theSockError,
@@ -45,3 +44,12 @@
 	    }
     }
 }
+
+/*
+ * epicsSocketConvertErrnoToString ()
+ */
+void epicsSocketConvertErrnoToString (
+        char * pBuf, unsigned bufSize )
+{
+    epicsSocketConvertErrorToString ( pBuf, bufSize, SOCKERRNO );
+}

=== modified file 'src/libCom/osi/os/default/epicsSocketConvertErrnoToString.cpp'
--- src/libCom/osi/os/default/epicsSocketConvertErrnoToString.cpp	2010-10-05 19:27:37 +0000
+++ src/libCom/osi/os/default/epicsSocketConvertErrnoToString.cpp	2015-02-10 20:17:50 +0000
@@ -22,14 +22,22 @@
 #include "osiSock.h"
 
 /*
- * epicsSocketConvertErrnoToString()
+ * epicsSocketConvertErrorToString()
  */
-void epicsSocketConvertErrnoToString ( 
-        char * pBuf, unsigned bufSize )
+void epicsSocketConvertErrorToString (
+        char * pBuf, unsigned bufSize, int theSockError )
 {
     if ( bufSize ) {
-        strncpy ( pBuf, strerror ( SOCKERRNO ), bufSize );
+        strncpy ( pBuf, strerror ( theSockError ), bufSize );
         pBuf[bufSize-1] = '\0';
     }
 }
 
+/*
+ * epicsSocketConvertErrnoToString()
+ */
+void epicsSocketConvertErrnoToString (
+        char * pBuf, unsigned bufSize )
+{
+    epicsSocketConvertErrorToString ( pBuf, bufSize, SOCKERRNO );
+}

=== modified file 'src/libCom/osi/osiSock.h'
--- src/libCom/osi/osiSock.h	2010-10-05 19:27:37 +0000
+++ src/libCom/osi/osiSock.h	2015-02-10 20:16:41 +0000
@@ -140,9 +140,11 @@
 epicsShareFunc void epicsShareAPI osiSockRelease (void);
 
 /*
- * convert socket error number to a string
+ * convert socket error numbers to a string
  */
-epicsShareFunc void epicsSocketConvertErrnoToString ( 
+epicsShareFunc void epicsSocketConvertErrorToString (
+        char * pBuf, unsigned bufSize, int error );
+epicsShareFunc void epicsSocketConvertErrnoToString (
         char * pBuf, unsigned bufSize );
 
 typedef union osiSockAddr {

