|  Developer
Updated on November 14, 2021

receive()

  • Receives data from a remote side. It’s an async call, never blocks, if there’s no data to read, returns immediately.
  • It’s a plugin’s author responsibility to make sure all data was consumed (repeatedly calling this function till all data gets consumed or, using I/O async notification, call this function when it exact has to be called).
  • Fetch data from an internal buffer, see inspect_data to data without fetching them.
Edit
  • params: hndl (int), amount of data to return, in bytes (int) [optional, by default will return all there is].
  • return: received data (string) [may be empty if there’s no data to read]
Edit
				
					require "network"

hndl = network.connect( {} )
data = network.receive( hndl, 100 )