ACE_Pipe Class Reference

Provides a portable bidirectional "pipe" abstraction. More...

#include <Pipe.h>

List of all members.

Public Member Functions

 ACE_Pipe (void)
 Default constructor (does nothing...).

 ACE_Pipe (ACE_HANDLE handles[2])
 Open the pipe and initialize the handles.

 ACE_Pipe (ACE_HANDLE read, ACE_HANDLE write)
 Initialize the ACE_Pipe from the read and write handles.

 ~ACE_Pipe (void)
 Default dtor. It doesn't close the handles for you.

int open (ACE_HANDLE handles[2])
 Open the pipe and initialize the handles.

int open (int buffer_size=ACE_DEFAULT_MAX_SOCKET_BUFSIZ)
 Open the pipe, setting the buffer size to the maximum.

int close (void)
 Close down the pipe HANDLEs;.

ACE_HANDLE read_handle (void) const
ACE_HANDLE write_handle (void) const
void dump (void) const
 Dump the state of the object.

ssize_t send (const void *buf, size_t n) const
 send upto bytes in .

ssize_t recv (void *buf, size_t n) const
 Recv upto bytes in .

ssize_t send_n (const void *buf, size_t n) const
 Send n bytes, keep trying until n are sent.

ssize_t send_n (const ACE_Message_Block *message_block, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0)
ssize_t recv_n (void *buf, size_t n) const
 Recv n bytes, keep trying until n are received.

ssize_t send (const iovec iov[], int n) const
 Send iovecs via <::writev>.

ssize_t recv (iovec iov[], int n) const
 Recv iovecs via <::readv>.

ssize_t send (size_t n,...) const
ssize_t recv (size_t n,...) const
ssize_t send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const
 Send bytes via Win32 WriteFile using overlapped I/O.

ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const
 Recv bytes via Win32 ReadFile using overlapped I/O.

ssize_t sendv (const iovec iov[], int n) const
 Send an of size to the file.

ssize_t sendv_n (const iovec iov[], int n) const
ssize_t recvv_n (iovec iov[], int n) const
 Receive an of size to the file.


Private Attributes

ACE_HANDLE handles_ [2]


Detailed Description

Provides a portable bidirectional "pipe" abstraction.

This class is designed to work with select()-based demuxers, such as the ACE_Select_Reactor, which is why it uses sockets on Windows rather than Win32 pipes (which aren't select()'able).

Definition at line 44 of file Pipe.h.


Constructor & Destructor Documentation

ACE_Pipe::ACE_Pipe void   ) 
 

Default constructor (does nothing...).

Definition at line 206 of file Pipe.cpp.

References ACE_TRACE.

00207 {
00208   ACE_TRACE ("ACE_Pipe::ACE_Pipe");
00209 
00210   this->handles_[0] = ACE_INVALID_HANDLE;
00211   this->handles_[1] = ACE_INVALID_HANDLE;
00212 }

ACE_Pipe::ACE_Pipe ACE_HANDLE  handles[2]  ) 
 

Open the pipe and initialize the handles.

Definition at line 214 of file Pipe.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and open().

00215 {
00216   ACE_TRACE ("ACE_Pipe::ACE_Pipe");
00217 
00218   if (this->open (handles) == -1)
00219     ACE_ERROR ((LM_ERROR,
00220                 ACE_LIB_TEXT ("ACE_Pipe::ACE_Pipe")));
00221 }

ACE_Pipe::ACE_Pipe ACE_HANDLE  read,
ACE_HANDLE  write
 

Initialize the ACE_Pipe from the read and write handles.

Definition at line 223 of file Pipe.cpp.

References ACE_TRACE.

00225 {
00226   ACE_TRACE ("ACE_Pipe::ACE_Pipe");
00227   this->handles_[0] = read;
00228   this->handles_[1] = write;
00229 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Pipe::~ACE_Pipe void   ) 
 

Default dtor. It doesn't close the handles for you.

Definition at line 11 of file Pipe.inl.

References ACE_TRACE.

00012 {
00013   ACE_TRACE ("ACE_Pipe::~ACE_Pipe");
00014   // Notice that the destructor doesn't close the handles for you.
00015 }


Member Function Documentation

int ACE_Pipe::close void   ) 
 

Close down the pipe HANDLEs;.

Definition at line 232 of file Pipe.cpp.

References ACE_TRACE, and ACE_OS::closesocket().

Referenced by ACE_Select_Reactor_Notify::close(), ACE_Dev_Poll_Reactor_Notify::close(), and open().

00233 {
00234   ACE_TRACE ("ACE_Pipe::close");
00235 
00236   int result = 0;
00237 
00238   // Note that the following will work even if we aren't closing down
00239   // sockets because <ACE_OS::closesocket> will just call <::close> in
00240   // that case!
00241 
00242   if (this->handles_[0] != ACE_INVALID_HANDLE)
00243     result = ACE_OS::closesocket (this->handles_[0]);
00244   this->handles_[0] = ACE_INVALID_HANDLE;
00245 
00246   if (this->handles_[1] != ACE_INVALID_HANDLE)
00247     result |= ACE_OS::closesocket (this->handles_[1]);
00248   this->handles_[1] = ACE_INVALID_HANDLE;
00249 
00250   return result;
00251 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Pipe::dump void   )  const
 

Dump the state of the object.

Definition at line 25 of file Pipe.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, and LM_DEBUG.

Referenced by ACE_Select_Reactor_Notify::dump(), and ACE_Dev_Poll_Reactor_Notify::dump().

00026 {
00027 #if defined (ACE_HAS_DUMP)
00028   ACE_TRACE ("ACE_Pipe::dump");
00029   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00030   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("handles_[0] = %d"), this->handles_[0]));
00031   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nhandles_[1] = %d"), this->handles_[1]));
00032   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
00033   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00034 #endif /* ACE_HAS_DUMP */
00035 }

int ACE_Pipe::open int  buffer_size = ACE_DEFAULT_MAX_SOCKET_BUFSIZ  ) 
 

Open the pipe, setting the buffer size to the maximum.

Definition at line 38 of file Pipe.cpp.

References ACE_SOCK_Acceptor::accept(), ACE_ERROR_RETURN, ACE_IPPROTO_TCP, ACE_LIB_TEXT, ACE_LOCALHOST, ACE_TRACE, close(), ACE_SOCK_Acceptor::close(), ACE_SOCK_Stream::close(), ACE_SOCK_Connector::connect(), ENOTSUP, ACE_IPC_SAP::get_handle(), ACE_SOCK::get_local_addr(), ACE_INET_Addr::get_port_number(), ACE_OS::ioctl(), LM_ERROR, ACE_SOCK_Acceptor::open(), ACE_OS::pipe(), ACE_SOCK::set_option(), ACE_OS::setsockopt(), and ACE_OS::socketpair().

00039 {
00040   ACE_TRACE ("ACE_Pipe::open");
00041 
00042 #if defined (ACE_LACKS_SOCKETPAIR) || defined (__Lynx__)
00043   ACE_INET_Addr my_addr;
00044   ACE_SOCK_Acceptor acceptor;
00045   ACE_SOCK_Connector connector;
00046   ACE_SOCK_Stream reader;
00047   ACE_SOCK_Stream writer;
00048   int result = 0;
00049 # if defined (ACE_WIN32)
00050   ACE_INET_Addr local_any  (static_cast<u_short> (0), ACE_LOCALHOST);
00051 # else
00052   ACE_Addr local_any = ACE_Addr::sap_any;
00053 # endif /* ACE_WIN32 */
00054 
00055   // Bind listener to any port and then find out what the port was.
00056   if (acceptor.open (local_any) == -1
00057       || acceptor.get_local_addr (my_addr) == -1)
00058     result = -1;
00059   else
00060     {
00061       ACE_INET_Addr sv_addr (my_addr.get_port_number (),
00062                              ACE_LOCALHOST);
00063 
00064       // Establish a connection within the same process.
00065       if (connector.connect (writer, sv_addr) == -1)
00066         result = -1;
00067       else if (acceptor.accept (reader) == -1)
00068         {
00069           writer.close ();
00070           result = -1;
00071         }
00072     }
00073 
00074   // Close down the acceptor endpoint since we don't need it anymore.
00075   acceptor.close ();
00076   if (result == -1)
00077     return -1;
00078 
00079   this->handles_[0] = reader.get_handle ();
00080   this->handles_[1] = writer.get_handle ();
00081 
00082 # if !defined (ACE_LACKS_TCP_NODELAY)
00083   int one = 1;
00084 
00085   // Make sure that the TCP stack doesn't try to buffer small writes.
00086   // Since this communication is purely local to the host it doesn't
00087   // affect network performance.
00088 
00089   if (writer.set_option (ACE_IPPROTO_TCP,
00090                          TCP_NODELAY,
00091                          &one,
00092                          sizeof one) == -1)
00093     {
00094       this->close ();
00095       return -1;
00096     }
00097 # endif /* ! ACE_LACKS_TCP_NODELAY */
00098 
00099 # if defined (ACE_LACKS_SOCKET_BUFSIZ)
00100     ACE_UNUSED_ARG (buffer_size);
00101 # else  /* ! ACE_LACKS_SOCKET_BUFSIZ */
00102   if (reader.set_option (SOL_SOCKET,
00103                          SO_RCVBUF,
00104                          reinterpret_cast <void *> (&buffer_size),
00105                          sizeof (buffer_size)) == -1
00106       && errno != ENOTSUP)
00107     {
00108       this->close ();
00109       return -1;
00110     }
00111   else if (writer.set_option (SOL_SOCKET,
00112                               SO_SNDBUF,
00113                               reinterpret_cast <void *> (&buffer_size),
00114                               sizeof (buffer_size)) == -1
00115            && errno != ENOTSUP)
00116     {
00117       this->close ();
00118       return -1;
00119     }
00120 # endif /* ! ACE_LACKS_SOCKET_BUFSIZ */
00121 
00122 #elif defined (ACE_HAS_STREAM_PIPES) || defined (__QNX__)
00123   ACE_UNUSED_ARG (buffer_size);
00124   if (ACE_OS::pipe (this->handles_) == -1)
00125     ACE_ERROR_RETURN ((LM_ERROR,
00126                        ACE_LIB_TEXT ("%p\n"),
00127                        ACE_LIB_TEXT ("pipe")),
00128                       -1);
00129 
00130 #if !defined(__QNX__)
00131   int arg = RMSGN;
00132 
00133   // Enable "msg no discard" mode, which ensures that record
00134   // boundaries are maintained when messages are sent and received.
00135   if (ACE_OS::ioctl (this->handles_[0],
00136                      I_SRDOPT,
00137                      (void *) arg) == -1
00138       || ACE_OS::ioctl (this->handles_[1],
00139                         I_SRDOPT,
00140                         (void *) arg) == -1)
00141     {
00142       this->close ();
00143       ACE_ERROR_RETURN ((LM_ERROR,
00144                          ACE_LIB_TEXT ("%p\n"),
00145                          ACE_LIB_TEXT ("ioctl")), -1);
00146     }
00147 #endif /* __QNX__ */
00148 
00149 #else  /* ! ACE_LACKS_SOCKETPAIR && ! ACE_HAS_STREAM_PIPES */
00150   if (ACE_OS::socketpair (AF_UNIX,
00151                           SOCK_STREAM,
00152                           0,
00153                           this->handles_) == -1)
00154     ACE_ERROR_RETURN ((LM_ERROR,
00155                        ACE_LIB_TEXT ("%p\n"),
00156                        ACE_LIB_TEXT ("socketpair")),
00157                       -1);
00158 # if defined (ACE_LACKS_SOCKET_BUFSIZ)
00159   ACE_UNUSED_ARG (buffer_size);
00160 # else  /* ! ACE_LACKS_SOCKET_BUFSIZ */
00161   if (ACE_OS::setsockopt (this->handles_[0],
00162                           SOL_SOCKET,
00163                           SO_RCVBUF,
00164                           reinterpret_cast <const char *> (&buffer_size),
00165                           sizeof (buffer_size)) == -1
00166       && errno != ENOTSUP)
00167     {
00168       this->close ();
00169       return -1;
00170     }
00171   if (ACE_OS::setsockopt (this->handles_[1],
00172                           SOL_SOCKET,
00173                           SO_SNDBUF,
00174                           reinterpret_cast <const char *> (&buffer_size),
00175                           sizeof (buffer_size)) == -1
00176       && errno != ENOTSUP)
00177     {
00178       this->close ();
00179       return -1;
00180     }
00181 # endif /* ! ACE_LACKS_SOCKET_BUFSIZ */
00182 #endif  /* ! ACE_LACKS_SOCKETPAIR && ! ACE_HAS_STREAM_PIPES */
00183   // Point both the read and write HANDLES to the appropriate socket
00184   // HANDLEs.
00185 
00186   return 0;
00187 }

int ACE_Pipe::open ACE_HANDLE  handles[2]  ) 
 

Open the pipe and initialize the handles.

Definition at line 190 of file Pipe.cpp.

References ACE_TRACE.

Referenced by ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager(), ACE_Pipe(), ACE_Select_Reactor_Notify::open(), and ACE_Dev_Poll_Reactor_Notify::open().

00191 {
00192   ACE_TRACE ("ACE_Pipe::open");
00193 
00194   if (this->open () == -1)
00195     return -1;
00196   else
00197     {
00198       handles[0] = this->handles_[0];
00199       handles[1] = this->handles_[1];
00200       return 0;
00201     }
00202 }

ACE_INLINE ACE_HANDLE ACE_Pipe::read_handle void   )  const
 

This is the "read" side of the pipe. Note, however, that processes can also write to this handle as well since pipes are bi-directional.

Definition at line 18 of file Pipe.inl.

References ACE_TRACE.

Referenced by ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager(), ACE_Select_Reactor_Notify::dispatch_notifications(), ACE_Dev_Poll_Reactor_Notify::dispatch_notifications(), ACE_Select_Reactor_Notify::notify_handle(), ACE_Dev_Poll_Reactor_Notify::notify_handle(), ACE_Select_Reactor_Notify::open(), and ACE_AIOCB_Notify_Pipe_Manager::~ACE_AIOCB_Notify_Pipe_Manager().

00019 {
00020   ACE_TRACE ("ACE_Pipe::read_handle");
00021   return this->handles_[0];
00022 }

ACE_INLINE ssize_t ACE_Pipe::recv void *  buf,
size_t  n,
ACE_OVERLAPPED overlapped
const
 

Recv bytes via Win32 ReadFile using overlapped I/O.

Definition at line 180 of file Pipe.inl.

References ACE_OVERLAPPED, ACE_TRACE, and ACE_OS::read().

00182 {
00183   ACE_TRACE ("ACE_Pipe::recv");
00184   return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n,
00185                        overlapped);
00186 }

ssize_t ACE_Pipe::recv size_t  n,
... 
const
 

This is an interface to ::readv, that doesn't use the struct iovec explicitly. The ... can be passed as an arbitrary number of (char *ptr, int len) tuples. However, the count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs!

Definition at line 305 of file Pipe.cpp.

References ACE_NEW_RETURN, ACE_TRACE, iovec::iov_base, iovec::iov_len, ACE_OS::readv(), ACE::recvv(), and ssize_t.

00306 {
00307   ACE_TRACE ("ACE_Pipe::recv");
00308   va_list argp;
00309   size_t total_tuples = n / 2;
00310   iovec *iovp;
00311 #if defined (ACE_HAS_ALLOCA)
00312   iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
00313 #else
00314   ACE_NEW_RETURN (iovp,
00315                   iovec[total_tuples],
00316                   -1);
00317 #endif /* !defined (ACE_HAS_ALLOCA) */
00318 
00319   va_start (argp, n);
00320 
00321   for (size_t i = 0; i < total_tuples; i++)
00322     {
00323       iovp[i].iov_base = va_arg (argp, char *);
00324       iovp[i].iov_len  = va_arg (argp, int);
00325     }
00326 
00327 #if defined (ACE_WIN32)
00328   ssize_t result = ACE::recvv (this->read_handle (),
00329                                iovp,
00330                                total_tuples);
00331 #else
00332   ssize_t result = ACE_OS::readv (this->read_handle (),
00333                                   iovp,
00334                                   total_tuples);
00335 #endif /* ACE_WIN32 */
00336 
00337 #if !defined (ACE_HAS_ALLOCA)
00338   delete [] iovp;
00339 #endif /* !defined (ACE_HAS_ALLOCA) */
00340   va_end (argp);
00341   return result;
00342 }

ACE_INLINE ssize_t ACE_Pipe::recv iovec  iov[],
int  n
const
 

Recv iovecs via <::readv>.

Definition at line 159 of file Pipe.inl.

References ACE_TRACE, ACE_OS::readv(), and ACE_OS::recvv().

00160 {
00161   ACE_TRACE ("ACE_Pipe::recv");
00162 #if defined (ACE_WIN32)
00163   return ACE_OS::recvv (this->read_handle (), iov, n);
00164 #else
00165   return ACE_OS::readv (this->read_handle (), iov, n);
00166 #endif /* ACE_WIN32 */
00167 }

ACE_INLINE ssize_t ACE_Pipe::recv void *  buf,
size_t  n
const
 

Recv upto bytes in .

Definition at line 137 of file Pipe.inl.

References ACE_TRACE, ACE_OS::read(), and ACE_OS::recv().

00138 {
00139   ACE_TRACE ("ACE_Pipe::recv");
00140 #if defined (ACE_WIN32)
00141   return ACE_OS::recv (this->read_handle (), static_cast <char *> (buf), n);
00142 #else
00143   return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n);
00144 #endif /* ACE_WIN32 */
00145 }

ACE_INLINE ssize_t ACE_Pipe::recv_n void *  buf,
size_t  n
const
 

Recv n bytes, keep trying until n are received.

Definition at line 115 of file Pipe.inl.

References ACE_TRACE, ACE::read_n(), and ACE::recv_n().

00116 {
00117   ACE_TRACE ("ACE_Pipe::recv_n");
00118 #if defined (ACE_WIN32)
00119   return ACE::recv_n (this->read_handle (), buf, n);
00120 #else
00121   return ACE::read_n (this->read_handle (), buf, n);
00122 #endif /* ACE_WIN32 */
00123 }

ACE_INLINE ssize_t ACE_Pipe::recvv_n iovec  iov[],
int  n
const
 

Receive an of size to the file.

Definition at line 68 of file Pipe.inl.

References ACE_TRACE, ACE_OS::readv(), and ACE_OS::sendv().

00069 {
00070   ACE_TRACE ("ACE_Pipe::recvv_n");
00071   // @@ Carlos, can you please update this to call the
00072   // new ACE::recvv_n() method that you write?
00073 #if defined (ACE_WIN32)
00074   return ACE_OS::sendv (this->read_handle (),
00075                         iov,
00076                         n);
00077 #else
00078   return ACE_OS::readv (this->read_handle (),
00079                         iov,
00080                         n);
00081 #endif /* ACE_WIN32 */
00082 }

ACE_INLINE ssize_t ACE_Pipe::send const void *  buf,
size_t  n,
ACE_OVERLAPPED overlapped
const
 

Send bytes via Win32 WriteFile using overlapped I/O.

Definition at line 170 of file Pipe.inl.

References ACE_OVERLAPPED, ACE_TRACE, and ACE_OS::write().

00172 {
00173   ACE_TRACE ("ACE_Pipe::send");
00174   return ACE_OS::write (this->write_handle (),
00175                         static_cast <const char *> (buf), n,
00176                         overlapped);
00177 }

ssize_t ACE_Pipe::send size_t  n,
... 
const
 

Send N char *ptrs and int lengths. Note that the char *'s precede the ints (basically, an varargs version of writev). The count N is the *total* number of trailing arguments, *not* a couple of the number of tuple pairs!

Definition at line 259 of file Pipe.cpp.

References ACE_NEW_RETURN, ACE_TRACE, iovec::iov_base, iovec::iov_len, ACE::sendv(), ssize_t, and ACE_OS::writev().

00260 {
00261   ACE_TRACE ("ACE_Pipe::send");
00262   va_list argp;
00263   size_t total_tuples = n / 2;
00264   iovec *iovp;
00265 #if defined (ACE_HAS_ALLOCA)
00266   iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
00267 #else
00268   ACE_NEW_RETURN (iovp,
00269                   iovec[total_tuples],
00270                   -1);
00271 #endif /* !defined (ACE_HAS_ALLOCA) */
00272 
00273   va_start (argp, n);
00274 
00275   for (size_t i = 0; i < total_tuples; i++)
00276     {
00277       iovp[i].iov_base = va_arg (argp, char *);
00278       iovp[i].iov_len  = va_arg (argp, int);
00279     }
00280 
00281 #if defined (ACE_WIN32)
00282   ssize_t result = ACE::sendv (this->write_handle (),
00283                                iovp,
00284                                total_tuples);
00285 #else
00286   ssize_t result = ACE_OS::writev (this->write_handle (),
00287                                    iovp,
00288                                    total_tuples);
00289 #endif /* ACE_WIN32 */
00290 
00291 #if !defined (ACE_HAS_ALLOCA)
00292   delete [] iovp;
00293 #endif /* !defined (ACE_HAS_ALLOCA) */
00294   va_end (argp);
00295   return result;
00296 }

ACE_INLINE ssize_t ACE_Pipe::send const iovec  iov[],
int  n
const
 

Send iovecs via <::writev>.

Definition at line 148 of file Pipe.inl.

References ACE_TRACE, ACE_OS::sendv(), and ACE_OS::writev().

00149 {
00150   ACE_TRACE ("ACE_Pipe::send");
00151 #if defined (ACE_WIN32)
00152   return ACE_OS::sendv (this->write_handle (), iov, n);
00153 #else
00154   return ACE_OS::writev (this->write_handle (), iov, n);
00155 #endif /* ACE_WIN32 */
00156 }

ACE_INLINE ssize_t ACE_Pipe::send const void *  buf,
size_t  n
const
 

send upto bytes in .

Definition at line 126 of file Pipe.inl.

References ACE_TRACE, ACE_OS::send(), and ACE_OS::write().

00127 {
00128   ACE_TRACE ("ACE_Pipe::send");
00129 #if defined (ACE_WIN32)
00130   return ACE_OS::send (this->write_handle (), static_cast <const char *> (buf), n);
00131 #else
00132   return ACE_OS::write (this->write_handle (), static_cast <const char *> (buf), n);
00133 #endif /* ACE_WIN32 */
00134 }

ACE_INLINE ssize_t ACE_Pipe::send_n const ACE_Message_Block message_block,
const ACE_Time_Value timeout = 0,
size_t *  bytes_transferred = 0
 

Send all the s chained through their and pointers. This call uses the underlying OS gather-write operation to reduce the domain-crossing penalty.

Definition at line 47 of file Pipe.inl.

References ACE_TRACE, ACE::send_n(), and ACE::write_n().

00050 {
00051   ACE_TRACE ("ACE_Pipe::send_n");
00052 #if defined (ACE_WIN32)
00053   return ACE::send_n (this->write_handle (),
00054                       message_block,
00055                       timeout,
00056                       bytes_transferred);
00057 #else
00058   ACE_UNUSED_ARG (timeout);
00059   return ACE::write_n (this->write_handle (),
00060                       message_block,
00061                       bytes_transferred);
00062 #endif /* ACE_WIN32 */
00063 }

ACE_INLINE ssize_t ACE_Pipe::send_n const void *  buf,
size_t  n
const
 

Send n bytes, keep trying until n are sent.

Definition at line 101 of file Pipe.inl.

References ACE_TRACE, ACE::send_n(), and ACE::write_n().

00102 {
00103   ACE_TRACE ("ACE_Pipe::send_n");
00104 #if defined (ACE_WIN32)
00105   return ACE::send_n (this->write_handle (), buf, n);
00106 #else
00107   return ACE::write_n (this->write_handle (), buf, n);
00108 #endif /* ACE_WIN32 */
00109 }

ACE_INLINE ssize_t ACE_Pipe::sendv const iovec  iov[],
int  n
const
 

Send an of size to the file.

Definition at line 87 of file Pipe.inl.

References ACE_TRACE, ACE_OS::sendv(), and ACE_OS::writev().

00088 {
00089   ACE_TRACE ("ACE_Pipe::sendv");
00090 #if defined (ACE_WIN32)
00091   return ACE_OS::sendv (this->write_handle (), iov, n);
00092 #else
00093   return ACE_OS::writev (this->write_handle (), iov, n);
00094 #endif /* ACE_WIN32 */
00095 }

ACE_INLINE ssize_t ACE_Pipe::sendv_n const iovec  iov[],
int  n
const
 

Send an of size to the file. Will block until all bytes are sent or an error occurs.

Definition at line 32 of file Pipe.inl.

References ACE_TRACE, ACE::sendv_n(), and ACE::writev_n().

00033 {
00034   ACE_TRACE ("ACE_Pipe::sendv_n");
00035 #if defined (ACE_WIN32)
00036   return ACE::sendv_n (this->write_handle (),
00037                       iov,
00038                       n);
00039 #else
00040   return ACE::writev_n (this->write_handle (),
00041                         iov,
00042                         n);
00043 #endif /* ACE_WIN32 */
00044 }

ACE_INLINE ACE_HANDLE ACE_Pipe::write_handle void   )  const
 

This is the "write" side of the pipe. Note, however, that processes can also read to this handle as well since pipes are bi-directional.

Definition at line 25 of file Pipe.inl.

References ACE_TRACE.

Referenced by ACE_AIOCB_Notify_Pipe_Manager::~ACE_AIOCB_Notify_Pipe_Manager().

00026 {
00027   ACE_TRACE ("ACE_Pipe::write_handle");
00028   return this->handles_[1];
00029 }


Member Data Documentation

ACE_HANDLE ACE_Pipe::handles_[2] [private]
 

Definition at line 154 of file Pipe.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:26:24 2006 for ACE by doxygen 1.3.6