source: nscp/include/check_nt/server/tcp_connection.cpp @ e1d9a58

0.4.00.4.10.4.2
Last change on this file since e1d9a58 was e1d9a58, checked in by Michael Medin <michael@…>, 22 months ago

Fixed broken server folder as well...

  • Property mode set to 100644
File size: 1.3 KB
Line 
1#include "tcp_connection.hpp"
2#include <vector>
3#include <boost/bind.hpp>
4#include <boost/logic/tribool.hpp>
5#include <boost/utility.hpp>
6#include <boost/tuple/tuple.hpp>
7#include <boost/asio/ssl.hpp>
8
9
10namespace check_nt {
11        namespace server {
12
13                tcp_connection::tcp_connection(boost::asio::io_service& io_service, boost::shared_ptr<check_nt::server::handler> handler)
14                        : connection(io_service, handler)
15                        , socket_(io_service)
16                {}
17
18                boost::asio::ip::tcp::socket& tcp_connection::socket() {
19                        return socket_;
20                }
21
22                void tcp_connection::stop() {
23                        handler_->log_debug(__FILE__, __LINE__, _T("stopped data connection"));
24                }
25
26                void tcp_connection::start_read_request(buffer_type &buffer, int timeout) {
27                        set_timeout(timeout);
28                        socket_.async_read_some(
29                                boost::asio::buffer(buffer),
30                                strand_.wrap(
31                                        boost::bind(&connection::handle_read_request, shared_from_this(), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)
32                                        )
33                                );
34                }
35                void tcp_connection::start_write_request(const std::vector<boost::asio::const_buffer>& response) {
36                        boost::asio::async_write(socket_, response,
37                                strand_.wrap(
38                                        boost::bind(&connection::handle_write_response, shared_from_this(),boost::asio::placeholders::error)
39                                        )
40                                );
41                }
42
43        } // namespace server
44} // namespace check_nt
Note: See TracBrowser for help on using the repository browser.