载入中...
搜索中...
未找到
eve::network::Channel类 参考

Length-prefixed (big-endian uint32) message framing over a TcpSocket. sendMsg() writes one framed message; feed() consumes bytes and emits received frames as "chmsg" events on the main thread via the Event module. 更多...

#include <Channel.h>

Public 成员函数

 Channel (TcpSocket *socket)
 Creates a channel over an existing socket (socket must be non-null).
 
 ~Channel ()
 
bool sendMsg (eve::data::ByteData *data)
 Sends one framed message.
 
bool sendMsgString (std::string s)
 Sends a string payload as one framed message (empty strings are rejected).
 
TcpSocketgetSocket () const
 The underlying TCP socket, or nullptr.
 
void feed (const std::vector< char > &bytes)
 Feeds received bytes into the frame parser. Called on the main thread from Network::pump / the emitCompletion path.
 

详细描述

Length-prefixed (big-endian uint32) message framing over a TcpSocket. sendMsg() writes one framed message; feed() consumes bytes and emits received frames as "chmsg" events on the main thread via the Event module.

在文件 Channel.h21 行定义.

构造及析构函数说明

◆ Channel()

eve::network::Channel::Channel ( TcpSocket socket)
explicit

Creates a channel over an existing socket (socket must be non-null).

在文件 Channel.cpp30 行定义.

引用了 EV_PARAM_CHECK.

◆ ~Channel()

eve::network::Channel::~Channel ( )

成员函数说明

◆ feed()

void eve::network::Channel::feed ( const std::vector< char > &  bytes)

◆ getSocket()

TcpSocket * eve::network::Channel::getSocket ( ) const
inline

The underlying TCP socket, or nullptr.

在文件 Channel.h36 行定义.

◆ sendMsg()

bool eve::network::Channel::sendMsg ( eve::data::ByteData data)

Sends one framed message.

参数
dataPayload bytes (must be non-null; size capped at kMaxFrameSize).
返回
True when the frame was handed to the socket.

在文件 Channel.cpp38 行定义.

引用了 c, eve::network::Channel, data, eve::network::Err, eve::network::kMaxFrameSize, n, eve::network::TcpSocket::network(), eve::network::Network::post(), eve::network::TcpSocket::send() , 以及 eve::network::NetCompletion::type.

被这些函数引用 sendMsgString().

◆ sendMsgString()

bool eve::network::Channel::sendMsgString ( std::string  s)

Sends a string payload as one framed message (empty strings are rejected).

在文件 Channel.cpp59 行定义.

引用了 data, s , 以及 sendMsg().


该类的文档由以下文件生成: