Subversion Repositories HomeAutomation

Rev

Rev 1962 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1962 Rev 1987
Line 72... Line 72...
72
}
72
}
73
 
73
 
74
void TcpClient::Send(common::Byteset data)
74
void TcpClient::Send(common::Byteset data)
75
{
75
{
76
  LOG_DEBUG_ENTER;
76
  LOG_DEBUG_ENTER;
-
 
77
 
-
 
78
  log::Debug(log_module_, "data=\"%s\", size=%u", std::string(data.begin(), data.end()).data(), data.size());
77
 
79
 
78
  try
80
  try
79
  {
81
  {
80
    if (this->socket_->is_open())
82
    if (this->socket_->is_open())
81
    {
83
    {
82
      this->socket_->send(boost::asio::buffer(data.Get(), data.GetMaxSize()));
84
      this->socket_->send(boost::asio::buffer(data.data(), data.size()));
83
    }
85
    }
84
  }
86
  }
85
  catch (std::exception& e)
87
  catch (std::exception& e)
86
  {
88
  {
87
    this->Disconnect();
89
    this->Disconnect();
88
      //throw std::runtime_error(e.what());
90
      //throw std::runtime_error(e.what());
89
  }
91
  }
90
 
92
 
91
  LOG_DEBUG_EXIT;
93
  LOG_DEBUG_EXIT;
92
}
94
}
93
 
95
 
94
void TcpClient::Read()
96
void TcpClient::Read()
95
{
97
{
96
  LOG_DEBUG_ENTER;
98
  LOG_DEBUG_ENTER;
97
 
99
 
98
  Client::Read();
100
  Client::Read();
99
   
101
 
-
 
102
  log::Debug(log_module_, "this->buffer_.capacity()=%u", this->buffer_.capacity());
-
 
103
   
100
  this->socket_->async_read_some(boost::asio::buffer(this->buffer_.Get(), this->buffer_.GetMaxSize()),
104
  this->socket_->async_read_some(boost::asio::buffer(this->buffer_.data(), this->buffer_.capacity()),
101
                                 boost::bind(&TcpClient::ReadHandler,
105
                                 boost::bind(&TcpClient::ReadHandler,
102
                                             this,
106
                                             this,
103
                                             boost::asio::placeholders::error,
107
                                             boost::asio::placeholders::error,
104
                                             boost::asio::placeholders::bytes_transferred));
108
                                             boost::asio::placeholders::bytes_transferred));
105
 
109