1xpasetfd(3)                   SAORD Documentation                  xpasetfd(3)
2
3
4

NAME

6       XPASetFd: send data from stdin to one or more XPA servers
7

SYNOPSIS

9         #include <xpa.h>
10
11         int XPASetFd(XPA xpa,
12                      char *template, char *paramlist, char *mode,
13                      int fd, char **names, char **messages, int n)
14

DESCRIPTION

16       Read data from a standard I/O fd and send it to one or more XPA servers
17       whose class:name identifier matches the specified template.
18
19       A template of the form "class1:name1" is sent to the XPA name server,
20       which returns a list of at most n matching XPA servers.  A connection
21       is established with each of these servers and the paramlist string is
22       passed to the server as the data transfer request is initiated. If an
23       XPA struct is passed to the call, then the persistent connections are
24       updated as described above. Otherwise, temporary connections are made
25       to the servers (which will be closed when the call completes).
26
27       The XPASetFd() routine then reads bytes from the specified fd until EOF
28       and sends these bytes to the XPA servers.  A string containing the
29       class:name and ip:port of each server is returned in the name array.
30       If a given server returned an error, then the error message will be
31       stored in the associated element of the messages array.
32
33       The return value will contain the actual number of servers that were
34       processed.  This value thus will hold the number of valid entries in
35       the names and messages arrays, and can be used to loop through these
36       arrays.  In names and/or messages is NULL, no information is passed
37       back in that array.
38
39       The mode string is of the form: "key1=value1,key2=value2,..."  The fol‐
40       lowing keywords are recognized:
41
42         key           value           default         explanation
43         ------        --------        --------        -----------
44         ack           true/false      true            if false, don't wait for ack from server (after callback completes)
45         verify        true/false      false           send buf from XPASet[Fd] to stdout
46
47       The ack keyword is useful in cases where one does not want to wait for
48       the server to complete, e.g. is a lot of processing needs to be done on
49       the passed data or when the success of the server operation is not rel‐
50       evant to the client.
51
52       Example:
53
54         #include <xpa.h>
55
56         #define NXPA 10
57         int  i, got;
58         int fd;
59         char *names[NXPA];
60         char *messages[NXPA];
61         fd = open(...);
62         got = XPASetFd(NULL, "ds9", "fits", NULL, fd, names, messages, NXPA);
63         for(i=0; i<got; i++){
64           if( messages[i] != NULL ){
65             /* error processing */
66             fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
67           }
68           if( names[i] )
69             free(names[i]);
70           if( messages[i] )
71             free(messages[i]);
72         }
73

SEE ALSO

75       See xpa(n) for a list of XPA help pages
76
77
78
79version 2.1.8                  November 1, 2007                    xpasetfd(3)
Impressum