|
大家好,
Poractor能够在windows下正常运行,移植到hp-unix ia64位平台,能够正常编译和启动,但我们发现服务端不能监听到客户端的连接请求,怀疑是proactor_run_event_loop没有正常工作,请教各位dx,有没有碰到过类似的问题。
平台:hp-unix ia64 B.11.23 U
Proactor: ACE_POSIX_AIOCB_Proactor
核心代码:
//建立proacor,并启动event_loop
int max_aio_operations = 512;
#ifdef _HPUX_11
static ProactorType proactor_type = AIOCB;
#else
static ProactorType proactor_type = DEFAULT;
#endif
create_proactor(proactor_type,max_aio_operations);
ACE_INET_Addr port_to_listen(m_nPort);
if (m_dcAcceptor.open (port_to_listen,0,1,ACE_DEFAULT_BACKLOG,1,0,0,1,1) == -1){
ACE_ERROR((LM_ERROR,"listen failure.\n"));
return -1;
}
ACE_Proactor::instance()->proactor_run_event_loop();
//监听到连接时,回调 handle_accept
void ClientAcceptor::handle_accept (const ACE_Asynch_Accept::Result &result)
{
ACE_DEBUG((LM_DEBUG,ACE_TEXT("accept.\n")));
ACE_Asynch_Acceptor<ClientService>::handle_accept(result);
}
//建立Proactor Stream
ClientService* ClientAcceptor :: make_handler()
{
ClientService* server;
ACE_DEBUG((LM_DEBUG,ACE_TEXT("Acceptor.\n")));
ACE_NEW_RETURN(server,ClientService,NULL);
return server;
}
程序运行结果:
(8730 | 1) ACE_POSIX_AIOCB_Proactor::Max Number of AIOs=256
(1) Create Proactor Type = AIOCB
(1) calling ACE_Asynch_Acceptor<>::open in file `/public/ace/include/ace/Asynch_Acceptor.cpp' on line 61
(1) calling ACE_Asynch_Acceptor<>::accept in file `/public/ace/include/ace/Asynch_Acceptor.cpp' on line 204
(1) leaving ACE_Asynch_Acceptor<>::accept
(1) leaving ACE_Asynch_Acceptor<>::open
当客户端连接时,服务端没有任何相应,奇快的是客户端显示是连接成功的。 |
|