TcpSyncClient

master
const an teen 2021-05-09 20:13:02 +03:00
parent ee1e105052
commit 6e7cff971e
4 changed files with 70 additions and 0 deletions

16
ircbot.pro 100644
View File

@ -0,0 +1,16 @@
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp \
tcpsyncclient.cpp
HEADERS += \
tcpsyncclient.h
LIBS += \
-lboost_system-mt \
-lws2_32

16
main.cpp 100644
View File

@ -0,0 +1,16 @@
#include <iostream>
#include "tcpsyncclient.h"
void usage(std::string argv)
{
std::cout << argv << " <address> <port>" << std::endl;
}
int main(int argc, char * argv[])
{
if (argc < 2) usage( std::string(argv[0]));
boost::asio::io_service service;
TcpSyncClient( std::string(argv[1]), std::string(argv[2]));
return 0;
}

12
tcpsyncclient.cpp 100644
View File

@ -0,0 +1,12 @@
#include "tcpsyncclient.h"
TcpSyncClient::TcpSyncClient(std::string a, std::string p) : m_address(a), m_port(p)
{
this->displayConfig();
}
void TcpSyncClient::displayConfig()
{
std::cout << "Address: " << m_address << std::endl;
std::cout << "Port: " << m_port << std::endl;
}

26
tcpsyncclient.h 100644
View File

@ -0,0 +1,26 @@
#ifndef TCPSYNCCLIENT_H
#define TCPSYNCCLIENT_H
#include <iostream>
#include <boost/bind/bind.hpp>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
using namespace boost::placeholders;
class TcpSyncClient
{
public:
TcpSyncClient(std::string a, std::string p);
private:
void displayConfig();
std::string m_address;
std::string m_port;
};
#endif // TCPSYNCCLIENT_H