2626
2727#include <stdio.h>
2828#include <string.h>
29- #include <errno.h>
3029
3130#include "py/nlr.h"
3231#include "py/objtuple.h"
3332#include "py/objlist.h"
3433#include "py/runtime.h"
34+ #include "py/mperrno.h"
3535#include "netutils.h"
3636#include "modnetwork.h"
3737
@@ -116,7 +116,7 @@ STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog) {
116116 if (self -> nic == MP_OBJ_NULL ) {
117117 // not connected
118118 // TODO I think we can listen even if not bound...
119- nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (ENOTCONN )));
119+ nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (MP_ENOTCONN )));
120120 }
121121
122122 int _errno ;
@@ -186,7 +186,7 @@ STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
186186 mod_network_socket_obj_t * self = self_in ;
187187 if (self -> nic == MP_OBJ_NULL ) {
188188 // not connected
189- nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (EPIPE )));
189+ nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (MP_EPIPE )));
190190 }
191191 mp_buffer_info_t bufinfo ;
192192 mp_get_buffer_raise (buf_in , & bufinfo , MP_BUFFER_READ );
@@ -204,7 +204,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
204204 mod_network_socket_obj_t * self = self_in ;
205205 if (self -> nic == MP_OBJ_NULL ) {
206206 // not connected
207- nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (ENOTCONN )));
207+ nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (MP_ENOTCONN )));
208208 }
209209 mp_int_t len = mp_obj_get_int (len_in );
210210 vstr_t vstr ;
@@ -253,7 +253,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
253253 mod_network_socket_obj_t * self = self_in ;
254254 if (self -> nic == MP_OBJ_NULL ) {
255255 // not connected
256- nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (ENOTCONN )));
256+ nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (MP_ENOTCONN )));
257257 }
258258 vstr_t vstr ;
259259 vstr_init_len (& vstr , mp_obj_get_int (len_in ));
@@ -314,7 +314,7 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
314314 mod_network_socket_obj_t * self = self_in ;
315315 if (self -> nic == MP_OBJ_NULL ) {
316316 // not connected
317- nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (ENOTCONN )));
317+ nlr_raise (mp_obj_new_exception_arg1 (& mp_type_OSError , MP_OBJ_NEW_SMALL_INT (MP_ENOTCONN )));
318318 }
319319 mp_uint_t timeout ;
320320 if (timeout_in == mp_const_none ) {
0 commit comments