acl/lib_acl_cpp/include/acl_cpp/connpool/tcp_sender.hpp

44 lines
743 B
C++
Raw Normal View History

#pragma once
2018-12-12 11:16:12 +08:00
#include "../acl_cpp_define.hpp"
#include "../stdlib/noncopyable.hpp"
2018-12-12 11:16:12 +08:00
struct iovec;
namespace acl
{
class socket_stream;
/**
* tcp ipc ͨ<EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2018-12-12 11:16:12 +08:00
*/
class ACL_CPP_API tcp_sender : public noncopyable
2018-12-12 11:16:12 +08:00
{
public:
tcp_sender(socket_stream& conn);
~tcp_sender(void);
/**
* <EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD>
* @param data {const void*} Ҫ<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><EFBFBD><EFBFBD>ַ
* @param len {unsigned int} <EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2018-12-12 11:16:12 +08:00
*/
bool send(const void* data, unsigned int len);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2018-12-12 11:16:12 +08:00
* @return {acl::socket_stream&}
*/
acl::socket_stream& get_conn(void) const
{
return *conn_;
}
private:
acl::socket_stream* conn_;
struct iovec* v2_;
};
} // namespace acl