1 #include "syncServer.h"
5 SyncServer::SyncServer(boost::asio::io_service
& io_service
, SyncTcpConnection::proto::endpoint tcp_endpoint
)
6 : acceptor_(io_service
, tcp_endpoint
)
11 void SyncServer::start_accept()
14 SyncTcpConnection::pointer new_connection
=
15 SyncTcpConnection::create(acceptor_
.io_service());
16 conns_
.push_back(new_connection
);
18 acceptor_
.async_accept(new_connection
->socket(),
19 boost::bind(&SyncServer::handle_accept
, this, new_connection
,
20 boost::asio::placeholders::error
));
23 void SyncServer::send(std::string message
)
26 for(std::list
<SyncTcpConnection::pointer
>::iterator it
= conns_
.begin() ;it
!= conns_
.end(); ++it
) {
31 void SyncServer::handle_accept(SyncTcpConnection::pointer new_connection
,
32 const boost::system::error_code
& error
)
36 new_connection
->onConnect
=onConnect
;
37 new_connection
->start();