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 c0130ccc5758f4927f407ebb89ed6bdaf706d1e2
parent 721c525db3d8cc147f76502cdb759a37b2c10b61
Author: Daniel Chavez <dacechavez@gmail.com>
Date:   Sat,  4 May 2019 23:11:49 +0200

mention the timeout argument in python recv()

Diffstat:
api/python.md | 13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/api/python.md b/api/python.md @@ -944,11 +944,16 @@ data = await sock.recv(1024) ### Description -Reads up to **maxlen** bytes from the socket. +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. + | Parameter | Description | | --- | --- | | maxlen | Maximum number of bytes to be read. | +| timeout | Optional timeout in milliseconds. | ### Returns @@ -962,6 +967,12 @@ if data is None: printf("eof!") else: print("received %s" % data) + +# Use optional timeout argument +try: + data = await sock.recv(1024, 1000) +except TimeoutError as e: + print("timed out reading (%s)" % e) ``` ---