2017-08-08 18:43:25 +08:00
|
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2017-2018
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* AUTHOR(S)
|
|
|
|
|
* Zheng Shuxin
|
|
|
|
|
* E-mail: zhengshuxin@qiyi.com
|
|
|
|
|
*
|
|
|
|
|
* VERSION
|
|
|
|
|
* Tue 08 Aug 2017 02:11:05 PM CST
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "../acl_cpp_define.hpp"
|
|
|
|
|
|
2017-08-08 18:54:13 +08:00
|
|
|
|
struct iovec;
|
|
|
|
|
|
2017-08-08 18:43:25 +08:00
|
|
|
|
namespace acl
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class socket_stream;
|
|
|
|
|
|
2017-08-09 16:04:54 +08:00
|
|
|
|
/**
|
2017-08-09 16:15:01 +08:00
|
|
|
|
* tcp ipc ͨ<EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-08-09 16:04:54 +08:00
|
|
|
|
*/
|
2017-08-08 18:43:25 +08:00
|
|
|
|
class ACL_CPP_API tcp_sender
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
tcp_sender(socket_stream& conn);
|
2017-08-08 18:54:13 +08:00
|
|
|
|
~tcp_sender(void);
|
2017-08-08 18:43:25 +08:00
|
|
|
|
|
2017-08-09 16:04:54 +08:00
|
|
|
|
/**
|
2017-08-09 16:15:01 +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>
|
2017-08-09 16:04:54 +08:00
|
|
|
|
*/
|
2017-08-08 18:43:25 +08:00
|
|
|
|
bool send(const void* data, unsigned int len);
|
|
|
|
|
|
2017-08-09 19:05:38 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {acl::socket_stream&}
|
|
|
|
|
*/
|
|
|
|
|
acl::socket_stream& get_conn(void) const
|
|
|
|
|
{
|
|
|
|
|
return *conn_;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-08 18:43:25 +08:00
|
|
|
|
private:
|
|
|
|
|
acl::socket_stream* conn_;
|
2017-08-08 18:54:13 +08:00
|
|
|
|
struct iovec* v2_;
|
2017-08-08 18:43:25 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|