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 01:57:39 PM CST
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
namespace acl
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class socket_stream;
|
|
|
|
|
class string;
|
|
|
|
|
|
2017-08-09 16:04:54 +08:00
|
|
|
|
/**
|
|
|
|
|
* tcp ipc 通信接收类,内部会自动读取完事的数据包
|
|
|
|
|
*/
|
2017-08-08 23:27:37 +08:00
|
|
|
|
class ACL_CPP_API tcp_reader
|
2017-08-08 18:43:25 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
tcp_reader(socket_stream& conn);
|
|
|
|
|
~tcp_reader(void) {}
|
|
|
|
|
|
2017-08-09 16:04:54 +08:00
|
|
|
|
/**
|
|
|
|
|
* 从对端读取数据,每次只读一个数据包
|
|
|
|
|
* @param out {string&} 存储数据包,内部采用追加方式往 out 添加数据
|
|
|
|
|
*/
|
2017-08-08 18:43:25 +08:00
|
|
|
|
bool read(string& out);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
socket_stream* conn_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|