12 #ifndef __UT_BOOSTASIOEXT_H__
13 #define __UT_BOOSTASIOEXT_H__
38 #define UT_SUPPORT_SENDFILE
41 #include <sys/sendfile.h>
43 #include <sys/types.h>
44 #include <sys/socket.h>
62 template <
typename Self>
65 hboost::system::error_code ec = hboost::system::error_code(),
66 std::size_t bytes_transfered = 0)
72 mySocket.native_non_blocking(
true, ec);
101 ec = hboost::system::error_code(
103 hboost::asio::error::get_system_category());
109 if (ec == hboost::asio::error::interrupted)
113 if (ec == hboost::asio::error::would_block
114 || ec == hboost::asio::error::try_again)
118 ASIO_TCPSocket::wait_write, std::move(
self));
122 if (ec || n == 0 ||
mySize <= 0)
145 template <
typename CompletionToken>
152 CompletionToken&& token) ->
153 typename hboost::asio::async_result<
155 void(hboost::system::error_code, std::size_t)>::return_type
157 return hboost::asio::async_compose<
158 CompletionToken,
void(hboost::system::error_code, std::size_t)>(
161 #endif // !defined(WIN32)
163 #endif // __UT_BOOSTASIOLINUXEXT_H__
hboost::asio::ip::tcp::socket ASIO_TCPSocket
This represents a Ipv4 address.
This represents either an Ipv4 address or an Ipv6 address.
UT_SendfileOp(ASIO_TCPSocket &socket, int fd, off_t offset, std::size_t size)
void operator()(Self &self, hboost::system::error_code ec=hboost::system::error_code(), std::size_t bytes_transfered=0)
UT_IpAddress UTconvertIPAddressType(hboost::asio::ip::address &from)
This represents a Ipv6 address.
auto UTasyncSendfile(ASIO_TCPSocket &socket, int fd, off_t offset, std::size_t size, CompletionToken &&token) -> typename hboost::asio::async_result< typename std::decay< CompletionToken >::type, void(hboost::system::error_code, std::size_t)>::return_type
std::size_t myBytesTransferred
ASIO_TCPSocket & mySocket