diff options
Diffstat (limited to 'examples/Reactor/Proactor/test_proactor.cpp')
-rw-r--r-- | examples/Reactor/Proactor/test_proactor.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/examples/Reactor/Proactor/test_proactor.cpp b/examples/Reactor/Proactor/test_proactor.cpp index 89fe5e67ef2..7d25fd9f3c4 100644 --- a/examples/Reactor/Proactor/test_proactor.cpp +++ b/examples/Reactor/Proactor/test_proactor.cpp @@ -33,10 +33,6 @@ ACE_RCSID(Proactor, test_proactor, "$Id$") -#if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) - // This only works on Win32 platforms and on Unix platforms supporting - // POSIX aio calls. - static char *host = 0; static u_short port = ACE_DEFAULT_SERVER_PORT; static char *file = "test_proactor.cpp"; @@ -93,8 +89,8 @@ private: }; Receiver::Receiver (void) - : dump_file_ (ACE_INVALID_HANDLE), - handle_ (ACE_INVALID_HANDLE) + : handle_ (ACE_INVALID_HANDLE), + dump_file_ (ACE_INVALID_HANDLE) { } @@ -158,7 +154,6 @@ Receiver::open (ACE_HANDLE handle, initial_read_size, 0, ACE_INVALID_HANDLE, - 0, 0); size_t bytes_transferred = message_block.length (); @@ -303,9 +298,6 @@ private: ACE_Asynch_Read_File rf_; // rf (read file): for writing from the file - ACE_Asynch_Transmit_File tf_; - // Transmit file. - ACE_HANDLE input_file_; // File to read from @@ -400,7 +392,8 @@ Sender::transmit_file (void) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); // Open ACE_Asynch_Transmit_File - if (this->tf_.open (*this) == -1) + ACE_Asynch_Transmit_File tf; + if (tf.open (*this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Transmit_File::open"), -1); // Header and trailer data for the file. @@ -409,11 +402,14 @@ Sender::transmit_file (void) this->welcome_message_.length (), this->welcome_message_.duplicate (), this->welcome_message_.length ()); - + + // Starting position + cerr << "Starting position: " << ACE_OS::lseek (file_handle, 0L, SEEK_CUR) << endl; + // Send it - if (this->tf_.transmit_file (file_handle, + if (tf.transmit_file (file_handle, &this->header_and_trailer_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Transmit_File::transmit_file"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Transmit_File::transmit_file"), -1); return 0; } @@ -436,9 +432,12 @@ Sender::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result) ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); + // Ending position + cerr << "Ending position: " << ACE_OS::lseek (result.file (), 0L, SEEK_CUR) << endl; + // Done with file ACE_OS::close (result.file ()); - + this->transmit_file_done_ = 1; if (this->stream_write_done_) done = 1; @@ -582,6 +581,7 @@ parse_args (int argc, char *argv[]) int main (int argc, char *argv[]) { + if (parse_args (argc, argv) == -1) return -1; @@ -616,5 +616,3 @@ template class ACE_Asynch_Acceptor<Receiver>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Asynch_Acceptor<Receiver> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/ |