aboutsummaryrefslogtreecommitdiffstats
path: root/c/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/sock.h')
-rw-r--r--c/sock.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/c/sock.h b/c/sock.h
index 9e4dd40..876e85c 100644
--- a/c/sock.h
+++ b/c/sock.h
@@ -42,6 +42,12 @@ static unsigned char net_recv(unsigned char s, void *buf, unsigned char max) {
_nr.op = 3; _nr.sock = s; _nr.buf = (unsigned char *)buf; _nr.len = max;
return sys_net(&_nr);
}
+/* non-blocking recv: one RX pump -> length, 0xFE if nothing buffered yet,
+ 0 on TCP EOF. Loop it with msleep() to own your timeout (see ping). */
+static unsigned char net_recv_nb(unsigned char s, void *buf, unsigned char max) {
+ _nr.op = 8; _nr.sock = s; _nr.buf = (unsigned char *)buf; _nr.len = max;
+ return sys_net(&_nr);
+}
/* set the local (source) port - needed so UDP replies demux back to us */
static unsigned char net_bind(unsigned char s, unsigned int port) {
_nr.op = 5; _nr.sock = s;