1/*************************************************************************
2 * libjson-rpc-cpp
3 *************************************************************************
4 * @file tcpsocketclient.cpp
5 * @date 17.07.2015
6 * @author Alexandre Poirot <alexandre.poirot@legrand.fr>
7 * @license See attached LICENSE.txt
8 ************************************************************************/
9
10#include "tcpsocketclient.h"
11
12#ifdef _WIN32
13#include "windowstcpsocketclient.h"
14#else
15#include "linuxtcpsocketclient.h"
16#endif
17
18using namespace jsonrpc;
19using namespace std;
20
21TcpSocketClient::TcpSocketClient(const std::string &ipToConnect, const unsigned int &port) {
22#ifdef _WIN32
23 this->realSocket = new WindowsTcpSocketClient(ipToConnect, port);
24#else
25 this->realSocket = new LinuxTcpSocketClient(ipToConnect, port);
26#endif
27}
28
29TcpSocketClient::~TcpSocketClient() { delete this->realSocket; }
30
31void TcpSocketClient::SendRPCMessage(const std::string &message, std::string &result) {
32 if (this->realSocket != NULL) {
33 this->realSocket->SendRPCMessage(message, result);
34 }
35}
36