本文整理汇总了C++中TCPClient::send_inl方法的典型用法代码示例。如果您正苦于以下问题:C++ TCPClient::send_inl方法的具体用法?C++ TCPClient::send_inl怎么用?C++ TCPClient::send_inl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPClient
的用法示例。
在下文中一共展示了TCPClient::send_inl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfterRecv
void TCPClient::AfterRecv(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf)
{
TcpClientCtx* theclass = (TcpClientCtx*)handle->data;
assert(theclass);
TCPClient* parent = (TCPClient*)theclass->parent_server;
if (nread < 0) {
if (parent->reconnectcb_) {
parent->reconnectcb_(NET_EVENT_TYPE_DISCONNECT, parent->reconnect_userdata_);
}
if (!parent->StartReconnect()) {
fprintf(stdout, "Start Reconnect Failure.\n");
return;
}
if (nread == UV_EOF) {
fprintf(stdout, "Server close(EOF), Client %p\n", handle);
LOG(INFO) << ("Server close(EOF)");
} else if (nread == UV_ECONNRESET) {
fprintf(stdout, "Server close(conn reset),Client %p\n", handle);
LOG(INFO) << ("Server close(conn reset)");
} else {
fprintf(stdout, "Server close,Client %p:%s\n", handle, GetUVError(nread).c_str());
LOG(INFO) << "Server close" << GetUVError(nread);
}
uv_close((uv_handle_t*)handle, AfterClientClose);//close before reconnect
return;
}
parent->send_inl(NULL);
if (nread > 0) {
theclass->packet_->recvdata((const unsigned char*)buf->base, nread);
}
}
示例2: AsyncCB
void TCPClient::AsyncCB(uv_async_t* handle)
{
TCPClient* theclass = (TCPClient*)handle->data;
if (theclass->isuseraskforclosed_) {
theclass->closeinl();
return;
}
//check data to send
theclass->send_inl(NULL);
}
示例3: AfterSend
void TCPClient::AfterSend(uv_write_t* req, int status)
{
TCPClient* theclass = (TCPClient*)req->data;
if (status < 0) {
if (theclass->writeparam_list_.size() > MAXLISTSIZE) {
FreeWriteParam((write_param*)req);
} else {
theclass->writeparam_list_.push_back((write_param*)req);
}
LOG(ERROR)<<"send error:" << GetUVError(status);
fprintf(stderr, "send error %s\n", GetUVError(status).c_str());
return;
}
theclass->send_inl(req);
}