Janet 1.11.3-9afcec7 Documentation
(Other Versions: 1.10.1 1.9.1 1.8.1 1.7.0 1.6.0 1.5.1 1.5.0 1.4.0 1.3.1 )

Net Module

Index

net/chunk net/close net/connect net/read net/server net/write


net/chunk cfunction
(net/chunk stream nbytes &opt buf)

Same a net/read, but will wait for all n bytes to arrive rather than return early.
Community Examples

net/close cfunction
(net/close stream)

Close a stream so that no further communication can occur.
Community Examples

net/connect cfunction
(net/connect host port)

Open a connection to communicate with a server. Returns a duplex stream that can be used to communicate with the server.
Community Examples

net/read cfunction
(net/read stream nbytes &opt buf)

Read up to n bytes from a stream, suspending the current fiber until the bytes are available. If less than n bytes are available (and more than 0), will push those bytes and return early. Returns a buffer with up to n more bytes in it.
Community Examples

net/server cfunction
(net/server host port handler)

Start a TCP server. handler is a function that will be called with a stream on each connection to the server. Returns a new stream that is neither readable nor writeable.
Community Examples

net/write cfunction
(net/write stream data)

Write data to a stream, suspending the current fiber until the write completes. Returns stream.
Community Examples