kore-doc

The kore documentation found under https://docs.kore.io/
Commits | Files | Refs | README | git clone https://git.kore.io/kore-doc.git

commit 1fe9afcaa3bb7e4d83be8a0ed194a6792787b583
parent f31fed274b1280650cfed0699eeca2bd9002ad58
Author: Joris Vink <joris@coders.se>
Date:   Sat, 23 Jan 2021 12:30:18 +0100

update for 4.1.0

Diffstat:
api/hooks.md | 6++++++
api/python.md | 46++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/api/hooks.md b/api/hooks.md @@ -3,6 +3,12 @@ Kore supports several hooking functions allowing your application to do things at certain times in the Kore startup / shutdown procedure. +The prototypes for these are found in the kore/hooks.h header file. + +``` +#include <kore/hooks.h> +``` + * [kore\_parent\_configure](#parentconfigure) * [kore\_parent\_daemonized](#parentdaemonized) * [kore\_parent\_teardown](#parentteardown) diff --git a/api/python.md b/api/python.md @@ -1515,7 +1515,7 @@ async def page(req): ### Synopsis ```python -data = await sock.recv(1024) +data = await sock.recv(maxlen, timeout) ``` ### Description @@ -1558,7 +1558,7 @@ except TimeoutError as e: ### Synopsis ```python -tuple = await sock.recvfrom(1024) +tuple = await sock.recvfrom(maxlen) ``` ### Description @@ -1589,6 +1589,48 @@ else: --- +### sock.recvmsg {#socketrecvmsg} + +### Synopsis + +```python +data, ancdata = await sock.recvmsg(maxlen, timeout) +``` + +### Description + +Reads up to **maxlen** bytes from the socket. The optional **timeout** argument +will throw a TimeoutError exception in case the timeout is hit before data is +read from the socket. If no timeout argument is specified, the call will wait +until data is available. + +The return ancillary data is in a list, with one tuple of 3 per entry: + +(cmsg_level, cmsg_type, cmsg_data) + +| Parameter | Description | + +| --- | --- | +| maxlen | Maximum number of bytes to be read. | +| timeout | Optional timeout in milliseconds. | + +### Returns + +The bytes read as a byte object, the ancelliry data as a list or None on EOF. + +### Example + +```python +data, ancdata = await sock.recvmsg(1024) +if data is None: + printf("eof!") +else: + for cmsg_level, cmsg_type, cmsg_data in ancdata: + # handle +``` + +--- + ### sock.send {#socketsend} ### Synopsis