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.  The final parameter n
29       specifies the maximum number of servers to contact.  A string
30       containing the class:name and ip:port of each server is returned in the
31       name array.  If a given server returned an error, then the error
32       message will be stored in the associated element of the messages array.
33       NB: if specified, the name and messages arrays must be of size n or
34       greater.
35
36       The return value will contain the actual number of servers that were
37       processed.  This value thus will hold the number of valid entries in
38       the names and messages arrays, and can be used to loop through these
39       arrays.  In names and/or messages is NULL, no information is passed
40       back in that array.
41
42       The mode string is of the form: "key1=value1,key2=value2,..."  The
43       following keywords are recognized:
44
45         key           value           default         explanation
46         ------        --------        --------        -----------
47         ack           true/false      true            if false, don't wait for ack from server (after callback completes)
48         verify        true/false      false           send buf from XPASet[Fd] to stdout
49
50       The ack keyword is useful in cases where one does not want to wait for
51       the server to complete, e.g. is a lot of processing needs to be done on
52       the passed data or when the success of the server operation is not
53       relevant to the client.
54
55       Example:
56
57         #include <xpa.h>
58
59         #define NXPA 10
60         int  i, got;
61         int fd;
62         char *names[NXPA];
63         char *messages[NXPA];
64         fd = open(...);
65         got = XPASetFd(NULL, "ds9", "fits", NULL, fd, names, messages, NXPA);
66         for(i=0; i<got; i++){
67           if( messages[i] != NULL ){
68             /* error processing */
69             fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
70           }
71           if( names[i] )
72             free(names[i]);
73           if( messages[i] )
74             free(messages[i]);
75         }
76

SEE ALSO

78       See xpa(n) for a list of XPA help pages
79
80
81
82version 2.1.15                   July 23, 2013                     xpasetfd(3)
Impressum