xpaset(3)
β¨ xpaset(3) β XPASet β¨
okay bestie, this is a page from the SAORD Documentation set, and it's literally all about yeeting data at XPA servers π it lives in section 3 of the manual (yes, the C-library section, we love a library function moment).
πΈ NAME πΈ
XPASet β send data to one or more XPA servers π
π SYNOPSIS π
#include <xpa.h>
int XPASet(XPA xpa,
char *template, char *paramlist, char *mode,
char *buf, size_t len, char **names, char **messages,
int n);
π¦ DESCRIPTION π¦
So the whole vibe here is: you're sending data to one or more XPA servers whose class:name identifier matches the template you pass in. That's it, that's the plot π«Ά
You hand over a template shaped like "class1:name1", and it gets sent to the XPA name server. The name server hands back a list of at most n matching XPA servers. Then a connection gets established with each one of those servers, and the paramlist string gets passed to the server right as the data transfer request kicks off. β¨
Now, if you pass an XPA struct into the call, the persistent connections get updated (as described above, iykyk). If you don't, then temporary connections are made to the servers instead β and those get closed the moment the call finishes. bye bestie π
The XPASet() routine transfers data from buf to the XPA servers. And the length of buf, in bytes, goes in the len variable. Don't forget it, fr fr, it matters π
A string with the class:name and ip:port of each of those servers comes back in the name array. And if a given server returned an error, or the server callback sends a message back to the client, then that message gets stored in the matching element of the messages array. π
NB: if you specify them, the name and messages arrays must be of size n or greater. no cap, this is not optional π
The returned message string is gonna look like this:
XPA$ERROR [error] (class:name ip:port)
or
XPA$MESSAGE [message] (class:name ip:port)
The return value is the actual number of servers that were processed π₯. So that number is literally the count of valid entries sitting in your names and messages arrays, which means you can use it to loop through them. Iconic. And if names and/or messages is NULL, then no information gets passed back in that particular array at all. no harm, no foul π
π§ the mode string π§
The mode string is shaped like this: "key1=value1,key2=value2,..."
And these are the keywords it recognizes, bestie:
ackβ valuetrue/false, defaulttrueβ iffalse, don't wait for ack from server (after callback completes)verifyβ valuetrue/false, defaultfalseβ send buf fromXPASet[Fd]to stdoutdoxpaβ valuetrue/false, defaulttrueβ client processes xpa requests
π the deets on ack π
The ack keyword is your bestie in situations where you do not want to wait for the server to finish. Like, say there's a ton of processing the server needs to do on the data you handed over, or when whether the server operation succeeded just isn't relevant to the client. Lowkey a lifesaver π
β the deets on doxpa β
Normally, an XPA client will process incoming XPA server requests while it's waiting for the client request to complete. Setting this variable to "false" will stop XPA server requests from being processed by the client. That's the whole thing, bestie. π
π Example π
#include <xpa.h>
#define NXPA 10
int i, got;
size_t len;
char *buf;
char *names[NXPA];
char *messages[NXPA];
...
[fill buf with data and set len to the length, in bytes, of the data]
...
/* send data to all access points */
got = XPASet(NULL, "ds9", "fits", NULL, buf, len, names, messages, NXPA);
/* error processing */
for(i=0; i<got; i++){
if( messages[i] ){
fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
}
if( names[i] ) free(names[i]);
if( messages[i] ) free(messages[i]);
}
π SEE ALSO π
See xpa(n) for a list of XPA help pages π
okay that's the whole page bestie, go forth and XPASet() responsibly πβ¨
this has been version 2.1.15, dated July 23, 2013, and it's the xpaset(3) page β mwah, take care of her ππ¦
π¦ where this page comes from
- debian bookworm: libxpa-dev 2.1.20-1 Β· MIT
- debian trixie: libxpa-dev 2.1.20-3 Β· MIT
- ubuntu jammy: libxpa-dev 2.1.20-1 Β· MIT
- ubuntu noble: libxpa-dev 2.1.20-1build1 Β· MIT
- ubuntu questing: libxpa-dev 2.1.20-3
- ubuntu resolute: libxpa-dev 2.1.20-3build1 Β· MIT
- ubuntu stonking: libxpa-dev 2.1.20-3build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms