xpasetfd(3)
π XPASetFd β the xpasetfd(3) glow-up π
okay bestie, settle in, because this is the xpasetfd(3) page from the SAORD Documentation crew and it is lowkey a whole vibe. it lives in the xpa.h cinematic universe, so go peek at xpa(n) when you're done here. π«Ά
β¨ NAME β¨
XPASetFd β send data from stdin to one or more XPA servers π
πΈ SYNOPSIS πΈ
#include <xpa.h>
int XPASetFd(XPA xpa,
char *template, char *paramlist, char *mode,
int fd, char **names, char **messages, int n)
π¦ DESCRIPTION π¦
So here's the tea, bestie: XPASetFd() reads data from a standard I/O fd and ships it off to one or more XPA servers whose class:name identifier matches the template you gave it. it's giving courier but make it β¨interprocess communicationβ¨.
A template shaped like "class1:name1" gets sent to the XPA name server, and that server hands back a list of at most n matching XPA servers. then we open a connection to each one of them, and the paramlist string gets passed to the server right as the data transfer request kicks off. if you handed an XPA struct to the call, the persistent connections get updated (as described above, iykyk). if you didn't, then we're making temporary connections to the servers, and those get closed the moment the call finishes. gone. ghosted. π
Then XPASetFd() does its thing: it reads bytes from the fd you specified until EOF, and sends all those bytes to the XPA servers. the final parameter n is the max number of servers we're gonna contact. a string with the class:name and ip:port of each server comes back in the names array. and if any given server returned an error, that error message gets stashed in the matching element of the messages array. π
NB: if you specify them, thenamesandmessagesarrays must be of sizenor greater. no cap. size them right or suffer.
The return value is the actual number of servers that got processed. so that number is literally the count of valid entries in your names and messages arrays, and you can use it to loop through them. if names and/or messages is NULL, then no information gets passed back in that array. simple as. π
The mode string looks like this:
"key1=value1,key2=value2,..."
and these keywords are the ones it recognizes, bestie:
ackβ value:true/false, default:trueβ iffalse, don't wait for ack from server (after callback completes)verifyβ value:true/false, default:falseβ send buf fromXPASet[Fd]to stdout
The ack keyword is so useful when you don't wanna sit around waiting for the server to finish. like, if a lot of processing needs to happen on the data you passed, or when the success of the server operation genuinely does not matter to the client. main character energy: send it and move on. π
β¨
π Example π
#include <xpa.h>
#define NXPA 10
int i, got;
int fd;
char *names[NXPA];
char *messages[NXPA];
fd = open(...);
got = XPASetFd(NULL, "ds9", "fits", NULL, fd, names, messages, NXPA);
for(i=0; i<got; i++){
if( messages[i] != NULL ){
/* error processing */
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 π§
and that's the whole page, bestie β version 2.1.15, dated July 23, 2013. iconic, timeless, a lil vintage. mwah πππ¦
π¦ 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