generated from AfonsoCMSousa/CPP-Template
44 lines
960 B
C++
44 lines
960 B
C++
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <iostream>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "app.hpp" // for app_info struct
|
|
#include "file.hpp" // for parce_args
|
|
#include "net.hpp" // for socket operations
|
|
#include "server_structs.h"
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char *argv[]) {
|
|
app_info app = parce_args(argc, argv);
|
|
api_packet packet;
|
|
|
|
Socket sock;
|
|
|
|
try {
|
|
// Connect socket to API
|
|
sock.connect_unix(app.app_api_socket_path.c_str(), app.app_port_out);
|
|
// Connect socket to Server
|
|
sock.connect_server(app.app_server_out_ip.c_str(), app.app_port_out);
|
|
|
|
// Right after connecting, send update rate request
|
|
char request[3] = {0};
|
|
request[0] = ACSP_REALTIMEPOS_INTERVAL;
|
|
request[1] = 127;
|
|
|
|
sock.send_server(request, sizeof(request));
|
|
|
|
} catch (const runtime_error &e) {
|
|
cerr << "Error: " << e.what() << endl;
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|