process_receive(p, @optional timeout, default)
Return an object read from the process p
. If timeout
is specified and no
response is received before it runs-out, the value of default
will be returned.
A process can send and receive numbers, symbols, strings, pairs and arrays. More complex objects like functions should be explicitly serialized and de-serialized. The functions object_to_u8array and u8array_to_object can be used for this.
let p = process(^(cp) showln("server says: ", process_receive(cp)))
process_send(p, "hello")
//> server says: hello
process_close(p)