ircabot/tcpsyncclient.h

35 lines
861 B
C++
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
using boost::system::error_code;
class TcpSyncClient
{
public:
TcpSyncClient(boost::asio::ip::tcp::endpoint, boost::asio::io_service&, const std::string);
private:
template <typename T>
void log(T);
bool connect_to_server();
size_t read_complete(char*, const error_code&, size_t);
int m_already_read;
bool m_started;
char m_buff[1024]; // Буффер 1Кб
std::string m_channel;
boost::asio::ip::tcp::endpoint m_ep;
boost::asio::ip::tcp::socket m_sock;
};
#endif // TCPSYNCCLIENT_H