8000 unix modsocket: Add comments re: recv() vs read(), etc. semantics. · micropython/micropython@6c62e72 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c62e72

Browse files
author
Paul Sokolovsky
committed
unix modsocket: Add comments re: recv() vs read(), etc. semantics.
1 parent b9be45e commit 6c62e72

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

unix/modsocket.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
148148
}
149149
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
150150

151+
// Note: besides flag param, this differs from read() in that
152+
// this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) -
153+
// these would be thrown as exceptions.
151154
STATIC mp_obj_t socket_recv(uint n_args, const mp_obj_t *args) {
152155
mp_obj_socket_t *self = args[0];
153156
int sz = MP_OBJ_SMALL_INT_VALUE(args[1]);
@@ -166,6 +169,9 @@ STATIC mp_obj_t socket_recv(uint n_args, const mp_obj_t *args) {
166169
}
167170
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_obj, 2, 3, socket_recv);
168171

172+
// Note: besides flag param, this differs from write() in that
173+
// this does not swallow blocking errors (EAGAIN, EWOULDBLOCK) -
174+
// these would be thrown as exceptions.
169175
STATIC mp_obj_t socket_send(uint n_args, const mp_obj_t *args) {
170176
mp_obj_socket_t *self = args[0];
171177
int flags = 0;

0 commit comments

Comments
 (0)
0