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

References ACE_TRACE.

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

ACE_Pipe::ACE_Pipe ACE_HANDLE  handles[2]  ) 
 

Open the pipe and initialize the handles.

Definition at line 215 of file Pipe.cpp.

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

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

ACE_Pipe::ACE_Pipe ACE_HANDLE  read,
ACE_HANDLE  write
 

Initialize the ACE_Pipe from the read and write handles.

Definition at line 224 of file Pipe.cpp.

References ACE_TRACE.

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

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

References ACE_TRACE, and ACE_OS::closesocket().

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

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

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(), ACE_OS::ioctl(), LM_ERROR, ACE_SOCK_Acceptor::open(), ACE_OS::pipe(), 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 #endif  /* ! ACE_LACKS_SOCKETPAIR && ! ACE_HAS_STREAM_PIPES */
00184   // Point both the read and write HANDLES to the appropriate socket
00185   // HANDLEs.
00186 
00187   return 0;
00188 }

int ACE_Pipe::open ACE_HANDLE  handles[2]  ) 
 

Open the pipe and initialize the handles.

Definition at line 191 of file Pipe.cpp.

References ACE_TRACE.

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

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

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_Select_Reactor_Notify::close(), ACE_Select_Reactor_Notify::dispatch_notifications(), ACE_Select_Reactor_Notify::notify_handle(), and ACE_Select_Reactor_Notify::open().

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

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

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

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

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

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

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 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 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 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.

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 Sun Jan 27 12:56:21 2008 for ACE by doxygen 1.3.6