这篇教程C++ ACE_INET_Addr函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACE_INET_Addr函数的典型用法代码示例。如果您正苦于以下问题:C++ ACE_INET_Addr函数的具体用法?C++ ACE_INET_Addr怎么用?C++ ACE_INET_Addr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACE_INET_Addr函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: config_importer/** * @return bool (false means an error occurred ) * @param inipath Doc at RoamingServer::ReadConfig */bool MapServer::ReadConfig(const std::string &inipath){ StringsBasedCfg config; ACE_Ini_ImpExp config_importer(config); ACE_Configuration_Section_Key root; std::string map_templates_dir; if(m_endpoint) { //TODO: perform shutdown, and load config ? ACE_DEBUG((LM_WARNING,ACE_TEXT("(%P|%t) MapServer already initialized and running/n") )); return true; } if (config.open () == -1) ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("(%P|%t) MapServer: %p/n"), ACE_TEXT ("config")),false); if (config_importer.import_config (inipath.c_str()) == -1) ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("(%P|%t) MapServer: Unable to open config file : %s/n"), inipath.c_str()),false); if(-1==config.open_section(config.root_section(),"MapServer",1,root)) ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("(%P|%t) MapServer: Config file %s is missing [MapServer] section/n"), inipath.c_str()),false); if(!RoamingServer::ReadConfig(inipath)) return false; config.get_addr(root,ACE_TEXT("listen_addr"),m_listen_point,ACE_INET_Addr(7002,"0.0.0.0")); config.get_addr(root,ACE_TEXT("location_addr"),m_location,ACE_INET_Addr(7002,"127.0.0.1")); config.get_addr(root,ACE_TEXT("location_addr"),m_location,ACE_INET_Addr(7002,"127.0.0.1")); config.get_string_value(root,ACE_TEXT("maps"),map_templates_dir,"."); m_online = false; return m_manager.load_templates(map_templates_dir);}
开发者ID:EnsonRedShirt,项目名称:Segs,代码行数:33,
示例2: argc_// constructor.QoS_Util::QoS_Util (int argc, ACE_TCHAR *argv[]) : argc_ (argc), argv_ (argv), source_port_ (SENDER_PORT), protocol_ (IPPROTO_UDP), multicast_flag_ (0){ ACE_NEW (this->mult_session_addr_, ACE_INET_Addr (ACE_DEFAULT_MULTICAST_PORT)); ACE_NEW (this->dest_addr_, ACE_INET_Addr (ACE_DEFAULT_SERVER_PORT));}
开发者ID:azraelly,项目名称:knetwork,代码行数:15,
示例3: ACE_TMAINintACE_TMAIN (int argc, ACE_TCHAR *argv[]){ u_short port = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_DEFAULT_SERVER_PORT; ACE_TLI_Acceptor server; ACE_TLI_Stream new_stream; // Open the server and reuse the address if in use... if (server.open (ACE_INET_Addr (port), 1) == -1) ACE_OS::t_error ("server.open"), ACE_OS::exit (1); // Wait for a connection from a client. This is an example of a // concurrent server. for (int count = 1; ; count++) { ACE_DEBUG ((LM_DEBUG, "thread %t, blocking for accept #%d/n", count)); if (server.accept (new_stream) == -1) ACE_OS::t_error ("server.accept error"); else if (thr_mgr.spawn (ACE_THR_FUNC (read_file), (void *) new_stream.get_handle (), THR_DETACHED | THR_BOUND) == -1) ACE_OS::perror ("can't create worker thread/n"); } ACE_NOTREACHED (return 0);}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:31,
示例4: ACE_TMAINintACE_TMAIN (int argc, ACE_TCHAR *argv[]){ if (parse_args (argc, argv) == -1) return -1; Sender sender; // Note: acceptor parameterized by the Receiver. ACE_Asynch_Acceptor<Receiver> acceptor; // If passive side if (host == 0) { if (acceptor.open (ACE_INET_Addr (port), initial_read_size, 1) == -1) return -1; } // If active side else if (sender.open (host, port) == -1) return -1; int success = 1; while (success > 0 && !done) // Dispatch events via Proactor singleton. success = ACE_Proactor::instance ()->handle_events (); return 0;}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:31,
示例5: ACE_TRACE// Constructor.ACE_RAPI_Session::ACE_RAPI_Session (void){ ACE_TRACE ("ACE_RAPI_Session::ACE_RAPI_Session"); //this->source_port (DEFAULT_SOURCE_SENDER_PORT); ACE_NEW (this->src_addr_, ACE_INET_Addr ("0"));}
开发者ID:AtVirus,项目名称:SkyFireEMU,代码行数:8,
示例6: ACE_GUARD_RETURNintDOwner::start_receiver(const ACE_INET_Addr & local){ ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, monitor, this->lock_, 0); if (this->connections_ >= MAX_CONNECTIONS || flg_cancel_ != 0) return -1; for (u_int i = 0; i < MAX_CONNECTIONS; ++i) { if (this->list_connections_ [i] == 0) { ACE_NEW_RETURN (this->list_connections_[i], Receiver (*this, i), -1); this->list_connections_[i]->open(local, ACE_INET_Addr((u_short)0)); return 0; } } ACE_ASSERT(0); return -1;}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:25,
示例7: ACE_DEBUGintHTTP_Connector::connect (const char * url){ char host[BUFSIZ]; u_short port; char path[BUFSIZ]; if (this->parseurl (url, host, &port, path) == -1) { ACE_DEBUG ((LM_DEBUG, "HTTP_Connector, error parsing url: %s/n", url)); return -1; } HTTP_Handler hh (path); HTTP_Handler *hhptr = &hh; // First check the cache. if (ACE_Filecache::instance ()->find (ACE_TEXT_CHAR_TO_TCHAR (hh.filename ())) == 0) { ACE_DEBUG ((LM_DEBUG, " ``%s'' is already cached./n", hh.filename ())); return 0; } return this->connector_.connect (hhptr, ACE_INET_Addr (port, host));}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:28,
示例8: ACE_TMAINintACE_TMAIN (int argc, ACE_TCHAR *argv[]){ if (parse_args (argc, argv) == -1) return -1; Sender sender; Receiver receiver; // If passive side if (host == 0) { if (receiver.open_addr (ACE_INET_Addr (port)) == -1) return -1; } // If active side else if (sender.open (host, port) == -1) return -1; for (int success = 1; success > 0 && !done; ) // Dispatch events via Proactor singleton. success = ACE_Proactor::instance ()->handle_events (); return 0;}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:28,
示例9: ACE_ERRORACE_INET_AddrTestDriver::parse_address(const std::string& spec){ std::string::size_type pos; if ((pos = spec.find(':')) == std::string::npos) { ACE_ERROR((LM_ERROR, "(%P|%t) Bad address (%s) - missing ':' char./n", spec.c_str())); throw TestException(); } if (pos == 0) { ACE_ERROR((LM_ERROR, "(%P|%t) Bad address (%s) - " "':' char can't be first char./n", spec.c_str())); throw TestException(); } if (pos == (spec.length() - 1)) { ACE_ERROR((LM_ERROR, "(%P|%t) Bad address (%s) - " "':' char can't be last char./n", spec.c_str())); throw TestException(); } return ACE_INET_Addr(spec.c_str());}
开发者ID:svn2github,项目名称:OpenDDS,代码行数:30,
示例10: run_receiver/*/brief Receive single datagram /note The function employes dgram_port and dgram_recv_timeout variables /retval -1 if not received, /retval 0 received a datagrams*/int run_receiver (){ ACE_DEBUG ((LM_INFO, ACE_TEXT ("Receiving datagrams from port %d with timeout %d ms/n"), dgram_port, dgram_recv_timeout.msec ())); ACE_SOCK_Dgram socket; ACE_INET_Addr remote ; static char dgram_buffer[BUFSIZ]; if (socket.open (ACE_INET_Addr (dgram_port)) != -1) if (socket.recv (dgram_buffer, sizeof (dgram_buffer), remote, 0, &dgram_recv_timeout) > 0) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("%C received/n"), dgram_buffer)); return 0; } else { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p/n"), ACE_TEXT ("Cannot receive datagrams")), -1); } else { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p: %d/n"), ACE_TEXT ("Cannot open broadcast socket on port"), dgram_port), -1); }}
开发者ID:esohns,项目名称:ATCD,代码行数:35,
示例11: ACE_INET_Addrint HandlersRegister::registerDgramHandlers (){ int i; // open dgram handlers for all ports for (i = 0; i < HandlersNo; ++i) if (-1 == DgramHandlers_[ i ]->open ( ACE_INET_Addr (i + BaseDgramPort, ACE_TEXT ("127.0.0.1"), ACE_PROTOCOL_FAMILY_INET))) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p/n"), ACE_TEXT ("Cannot open dgram handler")), -1); // register dgram handlers for (i = 0; i < HandlersNo; ++i) if (-1 == reactor_->register_handler (DgramHandlers_[ i ], ACE_Event_Handler::READ_MASK)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p/n"), ACE_TEXT ("Cannot register dgram handler")), -1); return 0;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:25,
示例12: ACE_UNUSED_ARGint DgramHandler::handle_timeout (const ACE_Time_Value ¤t_time, const void *act){ ACE_UNUSED_ARG (current_time); ACE_UNUSED_ARG (act); int sendBuffer = 0; if (++timeoutsTriggered_ >= expectedTriggers_) reactor ()->cancel_timer (this, 1); ACE_SOCK_Dgram socket; if (-1 == socket.open (ACE_INET_Addr (static_cast< u_short > (0), static_cast< ACE_UINT32 > (INADDR_ANY)), ACE_PROTOCOL_FAMILY_INET, 0, 1)) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P) %p/n"), ACE_TEXT ("Cannot open socket for sending Qt dgrams"))); ACE_INET_Addr peerAddr; peer_.get_local_addr (peerAddr); if (sizeof (sendBuffer) != socket.send (&sendBuffer, sizeof (sendBuffer), peerAddr)) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P) %p/n"), ACE_TEXT ("Cannot send dgram"))); else ++dgramsSent_; socket.close (); return 0;}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:32,
示例13: optintTeraSS_Acceptor::init (int argc, ACE_TCHAR *argv[]){ ACE_Get_Opt opt (argc, argv, ACE_TEXT("p:")); unsigned short p = 0; int c; while ((c = opt ()) != -1) switch (c) { case 'p': p = (unsigned short) ACE_OS::atoi (opt.optarg); break; default: break; } if (p == 0) p = 5555; if (this->open (ACE_INET_Addr (p)) == -1) { ACE_DEBUG ((LM_DEBUG, "%p/n", "ACE_Acceptor::open")); return -1; } return 0;}
开发者ID:asdlei00,项目名称:ACE,代码行数:29,
示例14: ACE_TMAINint ACE_TMAIN (int argc, ACE_TCHAR *argv[]){ if (argc < 2) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Usage: %s filename ") ACE_TEXT ("[server-host port-number]/n"), argv[0]), 1); const ACE_TCHAR *filename = argv[1]; const ACE_TCHAR *host_name = argc < 3 ? ACE_DEFAULT_SERVER_HOST : argv[2]; u_short port = argc < 4 ? ACE_DEFAULT_SERVER_PORT : ACE_OS::atoi (argv[3]); ACE_TLI_Stream client; ACE_TLI_Connector con; int fd; char buf[BUFSIZ]; if (con.connect (client, ACE_INET_Addr (port, host_name)) == -1) ACE_OS::t_error ((char *) host_name), ACE_OS::exit (1); if ((fd = ACE_OS::open (filename, O_RDONLY)) == -1) ACE_OS::perror (filename), ACE_OS::exit (1); for (int n; (n = ACE_OS::read (fd, buf, sizeof buf)) > 0; ) if (client.send_n (buf, n) != n) ACE_OS::t_error ("client.send error"); if (client.close () == -1) ACE_OS::t_error ("cli_close"), ACE_OS::exit (1); return 0;}
开发者ID:CCJY,项目名称:ACE,代码行数:33,
示例15: definedintHTTP_Server::asynch_thread_pool (void){// This only works on Win32#if defined (ACE_WIN32) // Create the appropriate acceptor for this concurrency strategy and // an appropriate handler for this I/O strategy ACE_Asynch_Acceptor<Asynch_HTTP_Handler_Factory> acceptor; // Tell the acceptor to listen on this->port_, which makes an // asynchronous I/O request to the OS. if (acceptor.open (ACE_INET_Addr (this->port_), HTTP_Handler::MAX_REQUEST_SIZE + 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "ACE_Asynch_Acceptor::open"), -1); // Create the thread pool. // Register threads with the proactor and thread manager. Asynch_Thread_Pool_Task t (*ACE_Proactor::instance (), this->tm_); // The proactor threads are waiting on the I/O Completion Port. // Wait for the threads to finish. return this->tm_.wait ();#endif /* ACE_WIN32 */ return -1;}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:28,
示例16: ACE_INET_AddrintLog_Wrapper::open (const int port, const char *mcast_addr){ struct hostent *host_info; ACE_utsname host_data; if (ACE_OS::uname (&host_data) < 0) return -1; if ((host_info = ACE_OS::gethostbyname (host_data.nodename)) == 0) return -1; else ACE_OS::memcpy ((char *) &this->log_msg_.host, (char *) host_info->h_addr, host_info->h_length); // This starts out initialized to all zeros! server_ = ACE_INET_Addr (port, mcast_addr); if (logger_.subscribe (server_) == -1) ACE_OS::perror("can't subscribe to multicast group"), ACE_OS::exit(1); // success. return 0;}
开发者ID:arun11299,项目名称:ACE-Code-Examples-Cpp,代码行数:25,
示例17: ACE_DEBUG void KSGLoopDeviceListenScheduler::Run() { int ret; _s_LoopReactor.owner(ACE_OS::thr_self()); LoopSvrAcceptor acceptor; if(_s_interface.LoadDLLFunc()) { ACE_DEBUG((LM_ERROR,"加载本地设备接口失败")); return; } int port = 9001;#ifndef _DEBUG // TODO: 正式环境从后台中读取参数 ACE_DEBUG((LM_NOTICE,"请设置侦听端口"));#endif if(acceptor.open(ACE_INET_Addr(port),&_s_LoopReactor)) { ACE_DEBUG((LM_ERROR,"Loop设备侦听失败,端口[%d]",port)); } else if((ret = _s_interface.Initialize())) { ACE_DEBUG((LM_ERROR,"初始化Loop接口失败,返回错误[%d]",ret)); } else { ACE_DEBUG((LM_INFO,"Loop设备开始侦听,线程号[%d]",ACE_OS::thr_self())); try { while(true) { ACE_Time_Value tv(5); _s_LoopReactor.handle_events(tv); Notify(); if(IsTerminated()) { while(!_s_LoopReactor.reactor_event_loop_done()) _s_LoopReactor.end_reactor_event_loop(); break; } } ACE_DEBUG((LM_NOTICE,"停止本地侦听服务")); if(_s_interface.Uninitialize()) { ACE_DEBUG((LM_ERROR,"调用Loop设备接口释放资源失败!")); } ACE_DEBUG((LM_INFO,"Loop设备服务线程结束")); } catch(...) { // 捕获所有异常 ACE_DEBUG((LM_NOTICE,"Loop设备服务线程执行异常")); } } }
开发者ID:nykma,项目名称:ykt4sungard,代码行数:56,
示例18: ACE_TMAINintACE_TMAIN (int argc, ACE_TCHAR *argv[]){ ACE_LOG_MSG->open (argv[0]); parse_args (argc, argv); // Default is to ask the server for ``help.'' static char buf[BUFSIZ] = "help/n"; int n; ACE_SOCK_Stream sc; ACE_SOCK_Connector con; if (con.connect (sc, ACE_INET_Addr (port_number, host_name)) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n%a", "connect", 1), -1); if (remote_reconfigure) // Remotely instruct the server to reconfigure itself. ACE_OS::strcpy (buf, "reconfigure/n"); // Send the command. if (sc.send_n (buf, ACE_OS::strlen (buf) + 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n%a", "send", 1), -1); // Next, read the response. while ((n = sc.recv (buf, sizeof buf)) > 0) if (ACE_OS::write (ACE_STDOUT, buf, n) != n) ACE_ERROR_RETURN ((LM_ERROR, "%p/n%a", "write", 1), -1); if (sc.close () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n%a", "close", 1), -1); return 0;}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:56,
示例19: GetProperty bool GetProperty(const mstrings_t& properties, const ACE_TString& prop, ACE_INET_Addr& addr) { ACE_TString str; if(GetProperty(properties, prop, str)) { addr = ACE_INET_Addr(str.c_str()); return true; } return false; }
开发者ID:BearWare,项目名称:TeamTalk5,代码行数:11,
示例20: ACE_TMAINintACE_TMAIN (int argc, ACE_TCHAR *argv[]){ ACE_UNUSED_ARG (initial_read_size); if (parse_args (argc, argv) == -1) return -1;#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) ACE_WIN32_Proactor * pImpl = new ACE_WIN32_Proactor;#elif defined (ACE_HAS_AIO_CALLS) // ACE_POSIX_AIOCB_Proactor * pImpl = new ACE_POSIX_AIOCB_Proactor; ACE_POSIX_SIG_Proactor * pImpl = new ACE_POSIX_SIG_Proactor;#endif ACE_Proactor Proactor ( pImpl ,1 ); ACE_Proactor::instance( & Proactor ); MyTask Task1 ; if (Task1.activate (THR_NEW_LWP, nThreads ) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "%p./n", "main"), -1); } Sender sender; ACE_Asynch_Acceptor<Receiver> acceptor; int Rc = -1 ; if ( host == NULL ) // Acceptor { // Simplify , initial read with zero size Rc = acceptor.open (ACE_INET_Addr (port),0,1); } else { Rc = sender.open (host, port); } if ( Rc == 0 ) { char c ; cout << "Press any key to stop and exit=>/n" << flush ; cin.clear (); cin >> c ; }
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:53,
示例21: mainint main(int argc, char* argv[]){ ACE_Reactor reactor; ACE_Acceptor<EchoServerHandler, ACE_SOCK_Acceptor> echoServerAcceptor; if (echoServerAcceptor.open(ACE_INET_Addr(DEFAULT_PORT), &reactor) == -1) return 1; reactor.run_reactor_event_loop(); return 0;}
开发者ID:Kintoun,项目名称:POSA,代码行数:12,
示例22: ACE_ERRORvoidSubDriver::parse_arg_s(const char* arg, bool& flag){ if (flag) { ACE_ERROR((LM_ERROR, "(%P|%t) Only one -s allowed on command-line./n")); throw TestException(); } std::string arg_str = arg; std::string::size_type pos; // Find the first ':' character, and make sure it is in a legal spot. if ((pos = arg_str.find_first_of(':')) == std::string::npos) { ACE_ERROR((LM_ERROR, "(%P|%t) Bad -s value (%s). " "Missing ':' chars./n", arg)); throw TestException(); } if (pos == 0) { ACE_ERROR((LM_ERROR, "(%P|%t) Bad -s value (%s). " "':' char cannot be first char./n", arg)); throw TestException(); } if (pos == arg_str.length() - 1) { ACE_ERROR((LM_ERROR, "(%P|%t) Bad -s value (%s). " "':' char cannot be last char./n", arg)); throw TestException(); } // Parse the sub_id from left of ':' char, and remainder to right of ':'. std::string sub_id_str(arg_str,0,pos); std::string sub_addr_str(arg_str,pos+1,std::string::npos); //use 3-arg constructor to build with VC6 TAO::DCPS::RepoId sub_id = ACE_OS::atoi(sub_id_str.c_str()); this->local_address_ = ACE_INET_Addr(sub_addr_str.c_str()); this->subscriber_.set_local_subscriber(sub_id); flag = true;}
开发者ID:svn2github,项目名称:OpenDDS,代码行数:53,
示例23: ACE_TMAINintACE_TMAIN (int argc, ACE_TCHAR *argv[]){ parse_args (argc, argv); void *cp; char buf[BUFSIZ]; ACE_TLI_Stream sc; ACE_TLI_Connector con; if (con.connect (sc, ACE_INET_Addr (port_number, host_name)) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "open"), -1); ACE_Mem_Map mmap (file_name, PROT_READ); if (mmap (cp) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "mmap"), -1); // Next, send the file's contents. if (sc.send_n (cp, mmap.size ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "send_n"), -1); if (sc.sndrel () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "close_writer"), -1); for (int n; (n = sc.recv (buf, sizeof buf)) > 0; ) if (ACE_OS::write (ACE_STDOUT, buf, n) != n) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "write"), -1); if (sc.close () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "close"), -1); return 0;}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:53,
示例24: INET_TRACE bool Session_T<ACE_SYNCH_USE>::connect (bool use_reactor) { INET_TRACE ("ACE_FTP_Session::connect"); typedef ACE_Connector<connection_type, ACE_SOCK_CONNECTOR> connector_type; this->close (); unsigned long f_reactor = use_reactor ? ACE_Synch_Options::USE_REACTOR : 0; ACE_Synch_Options sync_opt (ACE_Synch_Options::USE_TIMEOUT | f_reactor, this->ftp_timeout_); connector_type connector; connection_type* new_connection = 0; ACE_NEW_RETURN (new_connection, connection_type(sync_opt), false); if (connector.connect (new_connection, ACE_INET_Addr (this->port_, this->host_.c_str ()), ACE_Synch_Options (0,this->ftp_timeout_)) == -1) { INET_ERROR (1, (LM_ERROR, DLINFO ACE_TEXT ("(%d) ACE_FTP_Session::connect - ") ACE_TEXT ("failed to connect; host=%C, port=%d"), ACE_OS::last_error (), this->host_.c_str (), this->port_)); // as the connection was dynamically allocated // the connector causes it to be destroyed after // the connection failure return false; } this->connection_ = new_connection; this->connection_->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED); ACE_NEW_NORETURN (this->sock_stream_, sock_stream_type (this->connection_)); if (this->sock_stream_) { this->new_connect_ = true; this->cannot_reconnect_ = false; this->reactive_ = use_reactor; return true; } else { this->close (); return false; } }
开发者ID:asdlei00,项目名称:ACE,代码行数:52,
示例25: tintHTTP_Server::synch_thread_pool (void){ // Main thread opens the acceptor if (this->acceptor_.open (ACE_INET_Addr (this->port_), 1, PF_INET, this->backlog_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "HTTP_Acceptor::open"), -1); // Create a pool of threads to handle incoming connections. Synch_Thread_Pool_Task t (this->acceptor_, this->tm_, this->threads_); this->tm_.wait (); return 0;}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:14,
示例26: mainintmain (int, char **){ char addatapath[256]; ctgList url2ctg; init_env(); // Create the acceptor that will listen for client connetions HarvestAcceptor peer_acceptor; StrUtil::path_merge(addatapath, adhome, "data"); htmlTagEntity::init(addatapath); dbStore::prepare( config.GetStrVal("DBNAME", "ANYDICT"), config.GetStrVal("DBID", "inisoft"), config.GetStrVal("DBPASS", "gksehf")); /* ctgcnt = url2ctg.load(); ACE_DEBUG ((LM_INFO, "Ctg Prefix: %d/n", ctgcnt)); url2ctg.print(); */ categoryMapper::prepare(); if (peer_acceptor.open (ACE_INET_Addr (PORT), &reactor) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p/n", "open"), -1); ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); myCron mycron; mycron.activate(); // Perform service until the signal handler receives SIGINT. while (!finished) reactor.handle_events (); // Close the acceptor so that no more clients will be taken in. peer_acceptor.close(); dbStore::finish(); ACE_DEBUG ((LM_SHUTDOWN, "[%T] -- SHUT DOWN --/n")); return 0;}
开发者ID:handol,项目名称:OldWorks,代码行数:50,
示例27: INET_TRACE bool Session_T<ACE_SYNCH_USE>::connect_i (const ACE_Synch_Options& sync_opt) { INET_TRACE ("ACE_HTTP_Session::connect_i"); typedef ACE_Connector<connection_type, ACE_SOCK_CONNECTOR> connector_type; connector_type connector; connection_type* new_connection = 0; ACE_NEW_RETURN (new_connection, connection_type(sync_opt), false); if (connector.connect (new_connection, ACE_INET_Addr (this->port_, this->host_.c_str ()), ACE_Synch_Options (0,this->http_timeout_)) == -1) { INET_ERROR (1, (LM_ERROR, DLINFO ACE_TEXT ("(%d) ACE_HTTP_Session::connect_i - ") ACE_TEXT ("failed to connect; host=%C, port=%d/n"), ACE_OS::last_error (), this->host_.c_str (), this->port_)); // as the connection was dynamically allocated // the connector causes it to be destroyed after // the connection failure return false; } this->connection_ = new_connection; this->connection_->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED); ACE_NEW_NORETURN (this->sock_stream_, sock_stream_type (this->connection_)); if (this->sock_stream_) { this->cannot_reconnect_ = false; this->reactive_ = sync_opt[ACE_Synch_Options::USE_REACTOR]; // reset reconnect timer this->reconnect_timer_ = this->keep_alive_timeout_; this->reconnect_countdown_.start (); return true; } else { this->close (); return false; } }
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:50,
注:本文中的ACE_INET_Addr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACE_LIB_TEXT函数代码示例 C++ ACE_GUARD_RETURN函数代码示例 |