Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. while ( 1 )
  2. {
  3.     if ( m_tcp_sender != NULL )
  4.         // start waiting for new tcp connection
  5.         m_tcp_sender->initialize();
  6.  
  7.     bool session_running = true;
  8.  
  9.     while ( session_running )
  10.     {
  11.         ...
  12.         boost::thread t( &tcp_sender::send_thread, m_tcp_sender );
  13.         if ( !t.timed_join( boost::posix_time::milliseconds( 2000 ) ) )
  14.         {
  15.             session_running = false;
  16.         }
  17.         else if ( !m_tcp_sender->data_sent() )
  18.             session_running = false;
  19.         ....
  20.     }
  21.  
  22.     if ( m_tcp_sender != NULL )
  23.         // closes tcp socket ( drops connection )
  24.         m_tcp_sender->deinitialize();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement