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 9af2351..1298271 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);
}
+/* 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;
+ _nr.port_hi = (unsigned char)(port >> 8); _nr.port_lo = (unsigned char)port;
+ return sys_net(&_nr);
+}
static void net_close(unsigned char s) {
_nr.op = 4; _nr.sock = s; sys_net(&_nr);
}