BOSS
7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
TestBase64Client.cpp
Go to the documentation of this file.
1
// TestBase64Client.cpp : A simple xmlrpc client that returns a png file
2
// encoded as base64 data to the client.
3
//
4
// Usage: TestBase64Client serverHost serverPort outputfile
5
// Requests a png file from the specified server and saves it in outputfile.
6
// Link against xmlrpc lib and whatever socket libs your system needs (ws2_32.lib on windows)
7
8
#include "
XmlRpc.h
"
9
#include <iostream>
10
#include <fstream>
11
#include <stdlib.h>
12
13
using namespace
XmlRpc
;
14
15
int
main
(
int
argc,
char
* argv[])
16
{
17
if
(argc != 4) {
18
std::cerr <<
"Usage: TestBase64Client serverHost serverPort outputFile\n"
;
19
return
-1;
20
}
21
int
port = atoi(argv[2]);
22
23
//XmlRpc::setVerbosity(5);
24
XmlRpcClient
c(argv[1], port);
25
26
XmlRpcValue
noArgs, result;
27
if
(c.
execute
(
"TestBase64"
, noArgs, result))
28
{
29
const
XmlRpcValue::BinaryData
&
data
= result;
30
std::ofstream outfile(argv[3], std::ios::binary | std::ios::trunc);
31
if
(outfile.fail())
32
std::cerr <<
"Error opening "
<< argv[3] <<
" for output.\n"
;
33
else
34
{
35
int
n
= int(
data
.size());
36
for
(
int
i=0; i<
n
; ++i)
37
outfile <<
data
[i];
38
}
39
}
40
else
41
std::cout <<
"Error calling 'TestBase64'\n\n"
;
42
43
return
0;
44
}
45
n
const Int_t n
Definition
DataBase/tau_mode.c:65
data
TTree * data
Definition
DataBase/tau_mode.c:5
XmlRpc.h
XmlRpc::XmlRpcClient
A class to send XML RPC requests to a server and return the results.
Definition
XmlRpcClient.h:25
XmlRpc::XmlRpcClient::execute
bool execute(const char *method, XmlRpcValue const ¶ms, XmlRpcValue &result)
Definition
XmlRpcClient.cpp:77
XmlRpc::XmlRpcValue
RPC method arguments and results are represented by Values.
Definition
XmlRpcValue.h:22
XmlRpc::XmlRpcValue::BinaryData
std::vector< char > BinaryData
Definition
XmlRpcValue.h:39
XmlRpc
Definition
XmlRpc.h:35
main
int main()
Definition
test_IFile.cxx:11
7.1.1
Utilities
JobInfoSvc
JobInfoSvc-00-01-00
xmlrpc++0.7
test
TestBase64Client.cpp
Generated by
1.12.0