本文整理汇总了C++中LPDESC::ProcessOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDESC::ProcessOutput方法的具体用法?C++ LPDESC::ProcessOutput怎么用?C++ LPDESC::ProcessOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDESC
的用法示例。
在下文中一共展示了LPDESC::ProcessOutput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: io_loop
int io_loop(LPFDWATCH fdw)
{
LPDESC d;
int num_events, event_idx;
DESC_MANAGER::instance().DestroyClosed(); // PHASE_CLOSEАО БўјУµйА» ІчѕоБШґЩ.
DESC_MANAGER::instance().TryConnect();
if ((num_events = fdwatch(fdw, 0)) < 0)
return 0;
for (event_idx = 0; event_idx < num_events; ++event_idx)
{
d = (LPDESC) fdwatch_get_client_data(fdw, event_idx);
if (!d)
{
if (FDW_READ == fdwatch_check_event(fdw, tcp_socket, event_idx))
{
DESC_MANAGER::instance().AcceptDesc(fdw, tcp_socket);
fdwatch_clear_event(fdw, tcp_socket, event_idx);
}
else if (FDW_READ == fdwatch_check_event(fdw, p2p_socket, event_idx))
{
DESC_MANAGER::instance().AcceptP2PDesc(fdw, p2p_socket);
fdwatch_clear_event(fdw, p2p_socket, event_idx);
}
/*
else if (FDW_READ == fdwatch_check_event(fdw, udp_socket, event_idx))
{
char buf[256];
struct sockaddr_in cliaddr;
socklen_t socklen = sizeof(cliaddr);
int iBytesRead;
if ((iBytesRead = socket_udp_read(udp_socket, buf, 256, (struct sockaddr *) &cliaddr, &socklen)) > 0)
{
static CInputUDP s_inputUDP;
s_inputUDP.SetSockAddr(cliaddr);
int iBytesProceed;
s_inputUDP.Process(NULL, buf, iBytesRead, iBytesProceed);
}
fdwatch_clear_event(fdw, udp_socket, event_idx);
}
*/
continue;
}
int iRet = fdwatch_check_event(fdw, d->GetSocket(), event_idx);
switch (iRet)
{
case FDW_READ:
if (db_clientdesc == d)
{
int size = d->ProcessInput();
if (size)
sys_log(1, "DB_BYTES_READ: %d", size);
if (size < 0)
{
d->SetPhase(PHASE_CLOSE);
}
}
else if (d->ProcessInput() < 0)
{
d->SetPhase(PHASE_CLOSE);
}
break;
case FDW_WRITE:
if (db_clientdesc == d)
{
int buf_size = buffer_size(d->GetOutputBuffer());
int sock_buf_size = fdwatch_get_buffer_size(fdw, d->GetSocket());
int ret = d->ProcessOutput();
if (ret < 0)
{
d->SetPhase(PHASE_CLOSE);
}
if (buf_size)
sys_log(1, "DB_BYTES_WRITE: size %d sock_buf %d ret %d", buf_size, sock_buf_size, ret);
}
else if (d->ProcessOutput() < 0)
{
d->SetPhase(PHASE_CLOSE);
}
else if (g_TeenDesc==d)
{
int buf_size = buffer_size(d->GetOutputBuffer());
int sock_buf_size = fdwatch_get_buffer_size(fdw, d->GetSocket());
//.........这里部分代码省略.........