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

NAME

6       XPASet: send data to one or more XPA servers
7

SYNOPSIS

9         #include <xpa.h>
10
11         int XPASet(XPA xpa,
12                    char *template, char *paramlist, char *mode,
13                    char *buf, int len, char **names, char **messages,
14                    int n);
15

DESCRIPTION

17       Send data to one or more XPA servers whose class:name identifier
18       matches the specified template.
19
20       A template of the form "class1:name1" is sent to the XPA name server,
21       which returns a list of at most n matching XPA servers.  A connection
22       is established with each of these servers and the paramlist string is
23       passed to the server as the data transfer request is initiated. If an
24       XPA struct is passed to the call, the persistent connections are
25       updated as described above. Otherwise, temporary connections are made
26       to the servers (which will be closed when the call completes).
27
28       The XPASet() routine transfers data from buf to the XPA servers.  The
29       length of buf (in bytes) should be placed in the len variable.
30
31       A string containing the class:name and ip:port of each of these server
32       is returned in the name array.  If a given server returned an error or
33       the server callback sends a message back to the client, then the mes‐
34       sage will be stored in the associated element of the messages array.
35       NB: if specified, the name and messages arrays must be of size n or
36       greater.
37
38       The returned message string will be of the form:
39
40         XPA$ERROR   [error] (class:name ip:port)
41
42       or
43
44         XPA$MESSAGE [message] (class:name ip:port)
45
46       The return value will contain the actual number of servers that were
47       processed.  This value thus will hold the number of valid entries in
48       the names and messages arrays, and can be used to loop through these
49       arrays.  In names and/or messages is NULL, no information is passed
50       back in that particular array.
51
52       The mode string is of the form: "key1=value1,key2=value2,..."  The fol‐
53       lowing keywords are recognized:
54
55         key           value           default         explanation
56         ------        --------        --------        -----------
57         ack           true/false      true            if false, don't wait for ack from server (after callback completes)
58         verify        true/false      false           send buf from XPASet[Fd] to stdout
59         doxpa         true/false      true            client processes xpa requests
60
61       The ack keyword is useful in cases where one does not want to wait for
62       the server to complete, e.g. if a lot of processing needs to be done by
63       the server on the passed data or when the success of the server opera‐
64       tion is not relevant to the client.
65
66       Normally, an XPA client will process incoming XPA server requests while
67       awaiting the completion of the client request.  Setting this variable
68       to "false" will prevent XPA server requests from being processed by the
69       client.
70
71       Example:
72
73         #include <xpa.h>
74
75         #define NXPA 10
76         int  i, got;
77         int  len;
78         char *buf;
79         char *names[NXPA];
80         char *messages[NXPA];
81         ...
82         [fill buf with data and set len to the length, in bytes, of the data]
83         ...
84         /* send data to all access points */
85         got = XPASet(NULL, "ds9", "fits", NULL, buf, len, names, messages, NXPA);
86         /* error processing */
87         for(i=0; i<got; i++){
88           if( messages[i] ){
89             fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
90           }
91           if( names[i] )    free(names[i]);
92           if( messages[i] ) free(messages[i]);
93         }
94

SEE ALSO

96       See xpa(n) for a list of XPA help pages
97
98
99
100version 2.1.12                 January 26, 2010                      xpaset(3)
Impressum