18.4.0 released Sep 25, 2023
Read server

Purpose: Get results of a server call.

read-server <server> \
    [ data [ define ] <data> ] \
    [ data-length [ define ] <data length> ] \
    [ error [ define ] <error> ] \
    [ error-length [ define ] <error length> ] \
    [ status [ define ] <status> ] \
    [ status-text [ define ] <status text> ] \
    [ request-status [ define ] <request status> ]

Use read-server to get the results of call-server; the same <server> must be used in both.

- Getting the reply from server
The server reply is split in two. One part is the actual result of processing (called "stdout" or standard output), and that is "data". The other is the error messages (called "stderr" or standard error), and that's "error". If the server is Vely, all its output goes to "data", except from report-error and pf-out/pf-url/pf-web (with "to-error" clause) which goes to "error". Note that "data" and "error" streams can be co-mingled when output by the server, but they will be obtained separately. This allows for clean separation of output from any error messages.

<data> is the "data" reply of a server call (in "data" clause), <data length> is the number of bytes in <data> (in "data-length" clause). <error> is the "error" reply (in "error" clause), <error length> is the number of bytes in <error> (in "error-length" clause"). Note that a null-byte is always placed at the end of both <data> and <error> as a convenience, however this byte is not counted in <data length> and <error length>.

- Getting status of a server call
The status of a server call (as a number) can be obtained in <status> (in "status" clause). This is the protocol status of a server call, and it may be:
You can also obtain the status text in <status text> (in "status-text" clause); this is a human readable status message which is am empty string (i.e. "") if there is no error (meaning if <status> is VV_OKAY).

- Getting request (application) status
<request status> (in "request-status" clause) is the return status (as a number) of the code executing a remote server call; it is similar to a return value from a function. The particular server code you are calling may or may not return the status. If you are calling Vely server code, the return status can be sent back via exit-code statement.

For any of the above values you can obtain with read-server, you can create them with "define" statement. You must specify at least one value to obtain in read-server, or any number of them.
See examples in new-server and call-server.
See also
Distributed computing
See all

You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a link back to this page (dofollow) - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind.