本文整理汇总了C++中Sender::open方法的典型用法代码示例。如果您正苦于以下问题:C++ Sender::open方法的具体用法?C++ Sender::open怎么用?C++ Sender::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sender
的用法示例。
在下文中一共展示了Sender::open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
int
ACE_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;
}
示例2: if
int
ACE_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;
}
示例3: Proactor
int
ACE_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 ;
}