本文整理汇总了C++中Acceptor::get_total_r方法的典型用法代码示例。如果您正苦于以下问题:C++ Acceptor::get_total_r方法的具体用法?C++ Acceptor::get_total_r怎么用?C++ Acceptor::get_total_r使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acceptor
的用法示例。
在下文中一共展示了Acceptor::get_total_r方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addr
int
run_main (int argc, ACE_TCHAR *argv[])
{
ACE_START_TEST (ACE_TEXT ("TP_Reactor_Test"));
#if defined(ACE_HAS_THREADS)
if (::parse_args (argc, argv) == -1)
return -1;
::disable_signal (SIGPIPE, SIGPIPE);
MyTask task1;
Acceptor acceptor;
Connector connector;
if (task1.start (threads) == 0)
{
int rc = 0;
ACE_INET_Addr addr (port);
if (both != 0 || host == 0) // Acceptor
rc += acceptor.start (addr);
if (both != 0 || host != 0)
{
if (host == 0)
host = ACE_LOCALHOST;
if (addr.set (port, host, 1, addr.get_type ()) == -1)
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), host));
rc += connector.start (addr, senders);
}
if (rc > 0)
ACE_OS::sleep (seconds);
}
task1.stop ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("\nNumber of Receivers objects = %d\n")
ACE_TEXT ("\nNumber of Sender objects = %d\n"),
acceptor.get_number_sessions (),
connector.get_number_sessions ()));
// As Reactor event loop now is inactive it is safe to destroy all
// senders
connector.stop ();
acceptor.stop ();
//Print statistic
ACE_TCHAR bufs [256];
ACE_TCHAR bufr [256];
ACE_OS::sprintf ( bufs , ACE_TEXT ("%ld(%ld)"),
connector.get_total_snd(),
connector.get_total_w() );
ACE_OS::sprintf ( bufr , ACE_TEXT ("%ld(%ld)"),
connector.get_total_rcv(),
connector.get_total_r() );
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Connector/Senders total bytes: snd=%s rcv=%s\n"),
bufs,
bufr
));
ACE_OS::sprintf ( bufs , ACE_TEXT ("%ld(%ld)"),
acceptor.get_total_snd(),
acceptor.get_total_w() );
ACE_OS::sprintf ( bufr , ACE_TEXT ("%ld(%ld)"),
acceptor.get_total_rcv(),
acceptor.get_total_r() );
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Acceptor/Receivers total bytes: snd=%s rcv=%s\n"),
bufs,
bufr
));
#else /* ACE_HAS_THREADS */
ACE_UNUSED_ARG( argc );
ACE_UNUSED_ARG( argv );
#endif /* ACE_HAS_THREADS */
ACE_END_TEST;
return 0;
}