您当前的位置: 首页 > 

boost之asio实现定时器使用实例

phymat.nico 发布时间:2017-10-19 16:18:27 ,浏览量:5

#ifndef TCP_SERVER_H
#define TCP_SERVER_H

#include "boost_comm.h"

#include "tcp_client.h"
#include "session_manager.h"
#include "command_machine.h"
#include "task_engine.h"
#include "search_engine.h"

using namespace boost::asio;

namespace seemmo
{
	class tcp_server
	{
	public:
		tcp_server(const char *ip, int port, bool enprint = true);
		~tcp_server();
	public:
		typedef ip::tcp::socket socket_type;
		typedef std::shared_ptr sock_ptr;
	protected:
		void run()
		{
			m_io.run();
		}

		void func_run()
		{
			func_io.run();
		}
		boost::asio::deadline_timer *m_timer;
		bool enable_print;
		/* boost::asio::placeholders::error*/
	public:
		void print()
		{
			using namespace boost::posix_time;
			ptime now = second_clock::local_time();
			string now_str = to_iso_extended_string(now.date()) + " " + to_simple_string(now.time_of_day());
			cout remote_endpoint().port();
		//LOG(INFO)            
关注
打赏
1688896170
查看更多评论
0.0473s