#include <POSIX_Asynch_IO.h>
Inheritance diagram for ACE_POSIX_Asynch_Transmit_File:
Public Member Functions | |
ACE_POSIX_Asynch_Transmit_File (ACE_POSIX_Proactor *posix_proactor) | |
Constructor. | |
int | transmit_file (ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, size_t bytes_to_write, u_long offset, u_long offset_high, size_t bytes_per_send, u_long flags, const void *act, int priority, int signal_number=0) |
virtual | ~ACE_POSIX_Asynch_Transmit_File (void) |
Destructor. |
Definition at line 1007 of file POSIX_Asynch_IO.h.
|
Constructor.
Definition at line 2056 of file POSIX_Asynch_IO.cpp.
02057 : ACE_POSIX_Asynch_Operation (posix_proactor) 02058 { 02059 } |
|
Destructor.
Definition at line 2133 of file POSIX_Asynch_IO.cpp.
02134 { 02135 } |
|
This starts off an asynchronous transmit file. The is a handle to an open file. is a pointer to a data structure that contains pointers to data to send before and after the file data is sent. Set this parameter to 0 if you only want to transmit the file data. Upto will be written to the . If you want to send the entire file, let = 0. is the size of each block of data sent per send operation. Please read the POSIX documentation on what the flags should be. Implements ACE_Asynch_Transmit_File_Impl. Definition at line 2062 of file POSIX_Asynch_IO.cpp. References ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_OS::filesize(), LM_ERROR, and ssize_t.
02072 { 02073 // Adjust these parameters if there are default values specified. 02074 ssize_t file_size = ACE_OS::filesize (file); 02075 02076 if (file_size == -1) 02077 ACE_ERROR_RETURN ((LM_ERROR, 02078 "Error:%N:%l:%p\n", 02079 "POSIX_Asynch_Transmit_File:filesize failed"), 02080 -1); 02081 02082 if (bytes_to_write == 0) 02083 bytes_to_write = file_size; 02084 02085 if (offset > (size_t) file_size) 02086 ACE_ERROR_RETURN ((LM_ERROR, 02087 "Error:%p\n", 02088 "Asynch_Transmit_File:File size is less than offset"), 02089 -1); 02090 02091 if (offset != 0) 02092 bytes_to_write = file_size - offset + 1; 02093 02094 if (bytes_per_send == 0) 02095 bytes_per_send = bytes_to_write; 02096 02097 // Configure the result parameter. 02098 ACE_POSIX_Asynch_Transmit_File_Result *result = 0; 02099 02100 ACE_NEW_RETURN (result, 02101 ACE_POSIX_Asynch_Transmit_File_Result (this->handler_proxy_, 02102 this->handle_, 02103 file, 02104 header_and_trailer, 02105 bytes_to_write, 02106 offset, 02107 offset_high, 02108 bytes_per_send, 02109 flags, 02110 act, 02111 this->posix_proactor ()->get_handle (), 02112 priority, 02113 signal_number), 02114 -1); 02115 02116 // Make the auxillary handler and initiate transmit. 02117 ACE_POSIX_Asynch_Transmit_Handler *transmit_handler = 0; 02118 02119 ACE_NEW_RETURN (transmit_handler, 02120 ACE_POSIX_Asynch_Transmit_Handler (this->posix_proactor (), 02121 result), 02122 -1); 02123 02124 ssize_t return_val = transmit_handler->transmit (); 02125 02126 if (return_val == -1) 02127 // This deletes the <result> in it too. 02128 delete transmit_handler; 02129 02130 return 0; 02131 } |