cpp_redis/tacopie/sources/network/tcp_server.cpp
void
tcp_server::start(const std::string& host, std::uint32_t port, const on_new_connection_callback_t& callback) {
  if (is_running()) { __TACOPIE_THROW(warn, "tcp_server is already running"); }

  m_socket.bind(host, port);
  m_socket.listen(__TACOPIE_CONNECTION_QUEUE_SIZE);

  m_io_service->track(m_socket);
  m_io_service->set_rd_callback(m_socket, std::bind(&tcp_server::on_read_available, this, std::placeholders::_1));
  m_on_new_connection_callback = callback;

  m_is_running = true;

  __TACOPIE_LOG(info, "tcp_server running");
}
//!
//! start & stop the tcp server
//!
start & stop the tcp server
start & stop the tcp server
void
tcp_server::start(const std::string& host, std::uint32_t port, const on_new_connection_callback_t& callback) {
  if (is_running()) { __TACOPIE_THROW(warn, "tcp_server is already running"); }
  m_socket.bind(host, port);
  m_socket.listen(__TACOPIE_CONNECTION_QUEUE_SIZE);
  m_io_service->track(m_socket);
  m_io_service->set_rd_callback(m_socket, std::bind(&tcp_server::on_read_available, this, std::placeholders::_1));
  m_on_new_connection_callback = callback;
  m_is_running = true;
  __TACOPIE_LOG(info, "tcp_server running");
}
void tcp_server :: start ( const std :: string & host , std :: uint32_t port , const on_new_connection_callback_t & callback ) { if ( is_running ( ) ) { __TACOPIE_THROW ( warn , " " ) ; } m_socket . bind ( host , port ) ; m_socket . listen ( __TACOPIE_CONNECTION_QUEUE_SIZE ) ; m_io_service -> track ( m_socket ) ; m_io_service -> set_rd_callback ( m_socket , std :: bind ( & tcp_server :: on_read_available , this , std :: placeholders :: _1 ) ) ; m_on_new_connection_callback = callback ; m_is_running = true ; __TACOPIE_LOG ( info , " " ) ; }
start & stop the tcp server
start & stop the tcp server