-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo-client.cc
44 lines (35 loc) · 922 Bytes
/
echo-client.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include "client.h"
using namespace std;
int
main(int argc, char **argv)
{
int option;
// setup default arguments
int port = 6906;
string host = "localhost";
// process command line options using getopt()
// see "man 3 getopt"
while ((option = getopt(argc,argv,"h:p:")) != -1) {
switch (option) {
case 'p':
port = atoi(optarg);
break;
case 'h':
host = optarg;
break;
default:
cout << "client [-h host] [-p port]" << endl;
exit(EXIT_FAILURE);
}
}
Client client = Client(host, port);
std::ifstream ifs(argv [1]);
json j = json::parse(ifs);
j ["key"] = 3817 ;
client.create ();
cout << client.send_preset (j) << endl;
//~ client.get_response ();
}