Rev 1963 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1963 | Rev 1987 | ||
|---|---|---|---|
| Line 80... | Line 80... | ||
| 80 | } |
80 | } |
| 81 | 81 | ||
| 82 | void UdpClient::Send(common::Byteset data) |
82 | void UdpClient::Send(common::Byteset data) |
| 83 | { |
83 | { |
| 84 | LOG_DEBUG_ENTER; |
84 | LOG_DEBUG_ENTER; |
| - | 85 | ||
| - | 86 | log::Debug(log_module_, "data=\"%s\", size=%u", std::string(data.begin(), data.end()).data(), data.size()); |
|
| 85 | 87 | ||
| 86 | try |
88 | try |
| 87 | { |
89 | { |
| 88 | if (this->socket_->is_open()) |
90 | if (this->socket_->is_open()) |
| 89 | { |
91 | { |
| 90 | this->socket_->send_to(boost::asio::buffer(data. |
92 | this->socket_->send_to(boost::asio::buffer(data.data(), data.size()), this->endpoint_); |
| 91 | } |
93 | } |
| 92 | } |
94 | } |
| 93 | catch (std::exception& e) |
95 | catch (std::exception& e) |
| 94 | { |
96 | { |
| 95 | this->Disconnect(); |
97 | this->Disconnect(); |
| 96 | //throw std::runtime_error(e.what()); |
98 | //throw std::runtime_error(e.what()); |
| 97 | } |
99 | } |
| 98 | 100 | ||
| 99 | LOG_DEBUG_EXIT; |
101 | LOG_DEBUG_EXIT; |
| 100 | } |
102 | } |
| 101 | 103 | ||
| 102 | void UdpClient::Read() |
104 | void UdpClient::Read() |
| 103 | { |
105 | { |
| 104 | LOG_DEBUG_ENTER; |
106 | LOG_DEBUG_ENTER; |
| 105 | 107 | ||
| 106 | Client::Read(); |
108 | Client::Read(); |
| 107 | 109 | ||
| - | 110 | log::Debug(log_module_, "this->buffer_.capacity()=%u", this->buffer_.capacity()); |
|
| - | 111 | ||
| 108 | this->socket_->async_receive(boost::asio::buffer(this->buffer_. |
112 | this->socket_->async_receive(boost::asio::buffer(this->buffer_.data(), this->buffer_.capacity()), |
| 109 | boost::bind(&UdpClient::ReadHandler, |
113 | boost::bind(&UdpClient::ReadHandler, |
| 110 | this, |
114 | this, |
| 111 | boost::asio::placeholders::error, |
115 | boost::asio::placeholders::error, |
| 112 | boost::asio::placeholders::bytes_transferred)); |
116 | boost::asio::placeholders::bytes_transferred)); |
| 113 | 117 | ||