diff --git a/py/moduerrno.c b/py/moduerrno.c
index c7f2aacdfd4b1fe05a5cdbdc78000b2ded39fb4b..343b29ba08c27f7eab077f874f251f85756fa278 100644
--- a/py/moduerrno.c
+++ b/py/moduerrno.c
@@ -53,6 +53,7 @@
     X(ENOBUFS) \
     X(ENOTCONN) \
     X(ETIMEDOUT) \
+    X(ECONNREFUSED) \
     X(EHOSTUNREACH) \
     X(EALREADY) \
     X(EINPROGRESS) \
diff --git a/py/mperrno.h b/py/mperrno.h
index f7784f6f7327d84fe3cf8838aeccbb57d289ae3b..4d092de45205cdb941a621d71d6a42de22b00916 100644
--- a/py/mperrno.h
+++ b/py/mperrno.h
@@ -75,6 +75,7 @@
 #define MP_ENOBUFS          (105) // No buffer space available
 #define MP_ENOTCONN         (107) // Transport endpoint is not connected
 #define MP_ETIMEDOUT        (110) // Connection timed out
+#define MP_ECONNREFUSED     (111) // Connection refused
 #define MP_EHOSTUNREACH     (113) // No route to host
 #define MP_EALREADY         (114) // Operation already in progress
 #define MP_EINPROGRESS      (115) // Operation now in progress
@@ -128,6 +129,7 @@
 #define MP_ENOBUFS          ENOBUFS
 #define MP_ENOTCONN         ENOTCONN
 #define MP_ETIMEDOUT        ETIMEDOUT
+#define MP_ECONNREFUSED     ECONNREFUSED
 #define MP_EHOSTUNREACH     EHOSTUNREACH
 #define MP_EALREADY         EALREADY
 #define MP_EINPROGRESS      EINPROGRESS