6 | | Note that the RPC '''server''' is the core client, and the RPC '''client''' is a GUI or add-on communicating with it (such as BOINC Manager). It may seem confusing. This terminology will be used on the rest of the page. |
| 6 | Note that the RPC '''server''' is the core client, and the RPC '''client''' is a GUI or add-on communicating with it (such as BOINC Manager). This may seem confusing. This terminology will be used on the rest of the page. |
| 7 | |
| 8 | == Basic structure == |
| 9 | |
| 10 | The protocol is based on XML, and it's strictly request-reply. The client sends requests to the server, and waits for a reply; a reply is never sent back by the server without getting a request first. Both requests and replies are terminated with the control character `0x03`. Requests are inside `<boinc_gui_rpc_request>` elements, and replies from the client are inside `<boinc_gui_rpc_reply>` elements (in both cases there is a %x03 byte after the closing tag). |
| 11 | |
| 12 | Note that the core client (RPC server) doesn't support pipelining of requests (pipelining means sending a batch of multiple requests without waiting for a reply, then getting all the replies together; this improves latency). For compatibility, pipelining must not be used. |
| 13 | |
| 14 | If a command requires [#auth authentication] but the client hasn't authenticated yet, the RPC server will reply |
| 15 | {{{ |
| 16 | #!xml |
| 17 | <boinc_gui_rpc_reply> |
| 18 | <unauthorized/> |
| 19 | </boinc_gui_rpc_reply> |
| 20 | }}} |
| 21 | The client should be prepared to receive this in reply to any command. |
| 22 | |
| 23 | Successful commands usually get the reply: |
| 24 | {{{ |
| 25 | #!xml |
| 26 | <boinc_gui_rpc_reply> |
| 27 | <success/> |
| 28 | </boinc_gui_rpc_reply> |
| 29 | }}} |
| 30 | although individual commands may specify a different reply. For example, any command where the client is requesting information from the server would get that extra information in the command reply, instead of {{{<success/>}}}. |
| 31 | |
| 32 | If a command isn't successful, the reply is: |
| 33 | {{{ |
| 34 | #!xml |
| 35 | <boinc_gui_rpc_reply> |
| 36 | <error>human-readable error message</error> |
| 37 | </boinc_gui_rpc_reply> |
| 38 | }}} |
| 39 | A notable error message is "unrecognized op", which is returned if the server doesn't recognize a command. |