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 n bytes in buf.
ssize_t recv (void *buf, size_t n) const
 Recv upto n bytes in buf.
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 n bytes via Win32 WriteFile using overlapped I/O.
ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const
 Recv n bytes via Win32 ReadFile using overlapped I/O.
ssize_t sendv (const iovec iov[], int n) const
 Send an <iovec> of size n to the file.
ssize_t sendv_n (const iovec iov[], int n) const
ssize_t recvv_n (iovec iov[], int n) const
 Receive an iovec of size n 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 222 of file Pipe.cpp.

References ACE_TRACE, and handles_.

00223 {
00224   ACE_TRACE ("ACE_Pipe::ACE_Pipe");
00225 
00226   this->handles_[0] = ACE_INVALID_HANDLE;
00227   this->handles_[1] = ACE_INVALID_HANDLE;
00228 }

ACE_Pipe::ACE_Pipe ( ACE_HANDLE  handles[2]  ) 

Open the pipe and initialize the handles.

Definition at line 230 of file Pipe.cpp.

References ACE_ERROR, ACE_TEXT, ACE_TRACE, and LM_ERROR.

00231 {
00232   ACE_TRACE ("ACE_Pipe::ACE_Pipe");
00233 
00234   if (this->open (handles) == -1)
00235     ACE_ERROR ((LM_ERROR,
00236                 ACE_TEXT ("ACE_Pipe::ACE_Pipe")));
00237 }

ACE_Pipe::ACE_Pipe ( ACE_HANDLE  read,
ACE_HANDLE  write 
)

Initialize the ACE_Pipe from the read and write handles.

Definition at line 239 of file Pipe.cpp.

References ACE_TRACE, and handles_.

00241 {
00242   ACE_TRACE ("ACE_Pipe::ACE_Pipe");
00243   this->handles_[0] = read;
00244   this->handles_[1] = write;
00245 }

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 248 of file Pipe.cpp.

References ACE_TRACE, ACE_OS::closesocket(), and handles_.

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

00249 {
00250   ACE_TRACE ("ACE_Pipe::close");
00251 
00252   int result = 0;
00253 
00254   // Note that the following will work even if we aren't closing down
00255   // sockets because <ACE_OS::closesocket> will just call <::close> in
00256   // that case!
00257 
00258   if (this->handles_[0] != ACE_INVALID_HANDLE)
00259     result = ACE_OS::closesocket (this->handles_[0]);
00260   this->handles_[0] = ACE_INVALID_HANDLE;
00261 
00262   if (this->handles_[1] != ACE_INVALID_HANDLE)
00263     result |= ACE_OS::closesocket (this->handles_[1]);
00264   this->handles_[1] = ACE_INVALID_HANDLE;
00265 
00266   return result;
00267 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Pipe::dump ( void   )  const

Dump the state of the object.

Definition at line 26 of file Pipe.cpp.

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

Referenced by ACE_Select_Reactor_Notify::dump().

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

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 39 of file Pipe.cpp.

References ACE_SOCK_Acceptor::accept(), ACE_ERROR_RETURN, ACE_IPPROTO_TCP, ACE_LOCALHOST, ACE_TEXT, ACE_TRACE, AF_UNIX, 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(), handles_, ACE_OS::ioctl(), LM_ERROR, ACE_SOCK_Acceptor::open(), ACE_OS::pipe(), ACE_Addr::sap_any, ACE_SOCK::set_option(), ACE_OS::setsockopt(), SO_RCVBUF, SO_SNDBUF, SOCK_STREAM, ACE_OS::socketpair(), SOL_SOCKET, and TCP_NODELAY.

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

int ACE_Pipe::open ( ACE_HANDLE  handles[2]  ) 

Open the pipe and initialize the handles.

Definition at line 206 of file Pipe.cpp.

References ACE_TRACE, and handles_.

00207 {
00208   ACE_TRACE ("ACE_Pipe::open");
00209 
00210   if (this->open () == -1)
00211     return -1;
00212   else
00213     {
00214       handles[0] = this->handles_[0];
00215       handles[1] = this->handles_[1];
00216       return 0;
00217     }
00218 }

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, and handles_.

Referenced by ACE_Select_Reactor_Notify::close(), ACE_Select_Reactor_Notify::dispatch_notifications(), and ACE_Select_Reactor_Notify::notify_handle().

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 n bytes via Win32 ReadFile using overlapped I/O.

Definition at line 180 of file Pipe.inl.

References 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 321 of file Pipe.cpp.

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

00322 {
00323   ACE_TRACE ("ACE_Pipe::recv");
00324   va_list argp;
00325   int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
00326   iovec *iovp;
00327 #if defined (ACE_HAS_ALLOCA)
00328   iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
00329 #else
00330   ACE_NEW_RETURN (iovp,
00331                   iovec[total_tuples],
00332                   -1);
00333 #endif /* !defined (ACE_HAS_ALLOCA) */
00334 
00335   va_start (argp, n);
00336 
00337   for (int i = 0; i < total_tuples; ++i)
00338     {
00339       iovp[i].iov_base = va_arg (argp, char *);
00340       iovp[i].iov_len  = va_arg (argp, int);
00341     }
00342 
00343 #if defined (ACE_WIN32)
00344   ssize_t const result = ACE::recvv (this->read_handle (),
00345                                      iovp,
00346                                      total_tuples);
00347 #else
00348   ssize_t const result = ACE_OS::readv (this->read_handle (),
00349                                         iovp,
00350                                         total_tuples);
00351 #endif /* ACE_WIN32 */
00352 
00353 #if !defined (ACE_HAS_ALLOCA)
00354   delete [] iovp;
00355 #endif /* !defined (ACE_HAS_ALLOCA) */
00356   va_end (argp);
00357   return result;
00358 }

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 n bytes in buf.

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 iovec of size n 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 n bytes via Win32 WriteFile using overlapped I/O.

Definition at line 170 of file Pipe.inl.

References 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 275 of file Pipe.cpp.

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

00276 {
00277   ACE_TRACE ("ACE_Pipe::send");
00278   va_list argp;
00279   int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
00280   iovec *iovp;
00281 #if defined (ACE_HAS_ALLOCA)
00282   iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
00283 #else
00284   ACE_NEW_RETURN (iovp,
00285                   iovec[total_tuples],
00286                   -1);
00287 #endif /* !defined (ACE_HAS_ALLOCA) */
00288 
00289   va_start (argp, n);
00290 
00291   for (int i = 0; i < total_tuples; ++i)
00292     {
00293       iovp[i].iov_base = va_arg (argp, char *);
00294       iovp[i].iov_len  = va_arg (argp, int);
00295     }
00296 
00297 #if defined (ACE_WIN32)
00298   ssize_t result = ACE::sendv (this->write_handle (),
00299                                iovp,
00300                                total_tuples);
00301 #else
00302   ssize_t result = ACE_OS::writev (this->write_handle (),
00303                                    iovp,
00304                                    total_tuples);
00305 #endif /* ACE_WIN32 */
00306 
00307 #if !defined (ACE_HAS_ALLOCA)
00308   delete [] iovp;
00309 #endif /* !defined (ACE_HAS_ALLOCA) */
00310   va_end (argp);
00311   return result;
00312 }

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 n bytes in buf.

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 message_blocks chained through their <next> and <cont> 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 <iovec> of size n 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 iovec of size n 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, and handles_.

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.

Referenced by ACE_Pipe(), close(), open(), read_handle(), and write_handle().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:26 2010 for ACE by  doxygen 1.4.7