2 #include "ace/Global_Macros.h"
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
10 ACE_TRACE ("ACE_Pipe::~ACE_Pipe");
11 // Notice that the destructor doesn't close the handles for you.
15 ACE_Pipe::read_handle () const
17 ACE_TRACE ("ACE_Pipe::read_handle");
18 return this->handles_[0];
22 ACE_Pipe::write_handle () const
24 ACE_TRACE ("ACE_Pipe::write_handle");
25 return this->handles_[1];
29 ACE_Pipe::sendv_n (const iovec iov[], int n) const
31 ACE_TRACE ("ACE_Pipe::sendv_n");
32 #if defined (ACE_WIN32)
33 return ACE::sendv_n (this->write_handle (),
37 return ACE::writev_n (this->write_handle (),
40 #endif /* ACE_WIN32 */
44 ACE_Pipe::send_n (const ACE_Message_Block *message_block,
45 const ACE_Time_Value *timeout,
46 size_t *bytes_transferred)
48 ACE_TRACE ("ACE_Pipe::send_n");
49 #if defined (ACE_WIN32)
50 return ACE::send_n (this->write_handle (),
55 ACE_UNUSED_ARG (timeout);
56 return ACE::write_n (this->write_handle (),
59 #endif /* ACE_WIN32 */
62 // Recv an n byte message from the file.
65 ACE_Pipe::recvv_n (iovec iov[], int n) const
67 ACE_TRACE ("ACE_Pipe::recvv_n");
68 // @@ Carlos, can you please update this to call the
69 // new ACE::recvv_n() method that you write?
70 #if defined (ACE_WIN32)
71 return ACE_OS::sendv (this->read_handle (),
75 return ACE_OS::readv (this->read_handle (),
78 #endif /* ACE_WIN32 */
81 // Send an <iovec> of size <n> to the file.
84 ACE_Pipe::sendv (const iovec iov[], int n) const
86 ACE_TRACE ("ACE_Pipe::sendv");
87 #if defined (ACE_WIN32)
88 return ACE_OS::sendv (this->write_handle (), iov, n);
90 return ACE_OS::writev (this->write_handle (), iov, n);
91 #endif /* ACE_WIN32 */
94 // Send exactly N bytes from BUF to this file. Keeping trying until
95 // this many bytes are sent.
98 ACE_Pipe::send_n (const void *buf, size_t n) const
100 ACE_TRACE ("ACE_Pipe::send_n");
101 #if defined (ACE_WIN32)
102 return ACE::send_n (this->write_handle (), buf, n);
104 return ACE::write_n (this->write_handle (), buf, n);
105 #endif /* ACE_WIN32 */
108 // Receive exactly N bytes from this file into BUF. Keep trying until
109 // this many bytes are received.
112 ACE_Pipe::recv_n (void *buf, size_t n) const
114 ACE_TRACE ("ACE_Pipe::recv_n");
115 #if defined (ACE_WIN32)
116 return ACE::recv_n (this->read_handle (), buf, n);
118 return ACE::read_n (this->read_handle (), buf, n);
119 #endif /* ACE_WIN32 */
123 ACE_Pipe::send (const void *buf, size_t n) const
125 ACE_TRACE ("ACE_Pipe::send");
126 #if defined (ACE_WIN32)
127 return ACE_OS::send (this->write_handle (), static_cast <const char *> (buf), n);
129 return ACE_OS::write (this->write_handle (), static_cast <const char *> (buf), n);
130 #endif /* ACE_WIN32 */
134 ACE_Pipe::recv (void *buf, size_t n) const
136 ACE_TRACE ("ACE_Pipe::recv");
137 #if defined (ACE_WIN32)
138 return ACE_OS::recv (this->read_handle (), static_cast <char *> (buf), n);
140 return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n);
141 #endif /* ACE_WIN32 */
145 ACE_Pipe::send (const iovec iov[], int n) const
147 ACE_TRACE ("ACE_Pipe::send");
148 #if defined (ACE_WIN32)
149 return ACE_OS::sendv (this->write_handle (), iov, n);
151 return ACE_OS::writev (this->write_handle (), iov, n);
152 #endif /* ACE_WIN32 */
156 ACE_Pipe::recv (iovec iov[], int n) const
158 ACE_TRACE ("ACE_Pipe::recv");
159 #if defined (ACE_WIN32)
160 return ACE_OS::recvv (this->read_handle (), iov, n);
162 return ACE_OS::readv (this->read_handle (), iov, n);
163 #endif /* ACE_WIN32 */
167 ACE_Pipe::send (const void *buf, size_t n,
168 ACE_OVERLAPPED *overlapped) const
170 ACE_TRACE ("ACE_Pipe::send");
171 return ACE_OS::write (this->write_handle (),
172 static_cast <const char *> (buf), n,
177 ACE_Pipe::recv (void *buf, size_t n,
178 ACE_OVERLAPPED *overlapped) const
180 ACE_TRACE ("ACE_Pipe::recv");
181 return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n,
186 ACE_Pipe::close_handle (int which)
190 // Note that the following will work even if we aren't closing down
191 // sockets because <ACE_OS::closesocket> will just call <::close> in
194 if (this->handles_[which] != ACE_INVALID_HANDLE)
195 result = ACE_OS::closesocket (this->handles_[which]);
196 this->handles_[which] = ACE_INVALID_HANDLE;
200 ACE_END_VERSIONED_NAMESPACE_DECL