2019-07-28 10:31:56 +08:00
|
|
|
|
#pragma once
|
2018-12-12 11:16:12 +08:00
|
|
|
|
#include "../acl_cpp_define.hpp"
|
2019-05-09 13:57:51 +08:00
|
|
|
|
#include "../stdlib/noncopyable.hpp"
|
2018-12-12 11:16:12 +08:00
|
|
|
|
|
|
|
|
|
struct iovec;
|
|
|
|
|
|
|
|
|
|
namespace acl
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class socket_stream;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* tcp ipc ͨ<EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2018-12-12 11:16:12 +08:00
|
|
|
|
*/
|
2019-05-09 13:57:51 +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);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <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);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <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
|