Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_SOCK_Stream Class Reference

Defines the methods in the <ACE_SOCK_Stream> abstraction. More...

#include <SOCK_Stream.h>

Inheritance diagram for ACE_SOCK_Stream:

Inheritance graph
[legend]
Collaboration diagram for ACE_SOCK_Stream:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_INET_Addr PEER_ADDR

Public Methods

 ACE_SOCK_Stream (void)
 Constructor. More...

 ACE_SOCK_Stream (ACE_HANDLE h)
 Constructor (sets the underlying <ACE_HANDLE> with <h>). More...

 ~ACE_SOCK_Stream (void)
 Destructor. More...

ssize_t recv_n (void *buf, size_t len, int flags, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Try to recv exactly <len> bytes into <buf> from the connected socket. More...

ssize_t recv_n (void *buf, size_t len, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Try to recv exactly <len> bytes into <buf> from the connected socket. More...

ssize_t recvv_n (iovec iov[], int iovcnt, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Receive an <iovec> of size <iovcnt> from the connected socket. More...

ssize_t send_n (const void *buf, size_t len, int flags, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Try to send exactly <len> bytes from <buf> to the connection socket. More...

ssize_t send_n (const void *buf, size_t len, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Try to send exactly <len> bytes from <buf> to the connected socket. More...

ssize_t send_n (const ACE_Message_Block *message_block, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Send all the <message_block>s chained through their <next> and <cont> pointers. This call uses the underlying OS gather-write operation to reduce the domain-crossing penalty. More...

ssize_t sendv_n (const iovec iov[], int iovcnt, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Send an <iovec> of size <iovcnt> to the connected socket. More...

ssize_t send_urg (const void *ptr, size_t len=sizeof(char), const ACE_Time_Value *timeout=0) const
ssize_t recv_urg (void *ptr, size_t len=sizeof(char), const ACE_Time_Value *timeout=0) const
int close_reader (void)
 Close down the reader. More...

int close_writer (void)
 Close down the writer. More...

int close (void)
void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Detailed Description

Defines the methods in the <ACE_SOCK_Stream> abstraction.

This adds additional wrapper methods atop the <ACE_SOCK_IO> class.

<buf> is the buffer to write from or receive into. <len> is the number of bytes to transfer. The <timeout> parameter in the following methods indicates how long to blocking trying to transfer data. If <timeout> == 0, then the call behaves as a normal send/recv call, i.e., for blocking sockets, the call will block until action is possible; for non-blocking sockets, EWOULDBLOCK will be returned if no action is immediately possible. If <timeout> != 0, the call will wait for data to arrive no longer than the relative time specified in *<timeout>. The "_n()" I/O methods keep looping until all the data has been transferred. These methods also work for sockets in non-blocking mode i.e., they keep looping on EWOULDBLOCK. <timeout> is used to make sure we keep making progress, i.e., the same timeout value is used for every I/O operation in the loop and the timeout is not counted down. The return values for the "*_n()" methods match the return values from the non "_n()" methods and are specified as follows:

On partial transfers, i.e., if any data is transferred before timeout/error/EOF, <bytes_transferred> will contain the number of bytes transferred. Methods with <iovec> parameter are I/O vector variants of the I/O operations. Methods with the extra <flags> argument will always result in <send> getting called. Methods without the extra <flags> argument will result in <send> getting called on Win32 platforms, and <write> getting called on non-Win32 platforms.

Definition at line 69 of file SOCK_Stream.h.


Member Typedef Documentation

typedef ACE_INET_Addr ACE_SOCK_Stream::PEER_ADDR
 

Reimplemented in ACE_LSOCK_Stream.

Definition at line 153 of file SOCK_Stream.h.


Constructor & Destructor Documentation

ASYS_INLINE ACE_SOCK_Stream::ACE_SOCK_Stream void   
 

Constructor.

Definition at line 7 of file SOCK_Stream.i.

00008 {
00009   // ACE_TRACE ("ACE_SOCK_Stream::ACE_SOCK_Stream");
00010 }

ASYS_INLINE ACE_SOCK_Stream::ACE_SOCK_Stream ACE_HANDLE    h
 

Constructor (sets the underlying <ACE_HANDLE> with <h>).

Definition at line 13 of file SOCK_Stream.i.

References ACE_IPC_SAP::set_handle.

00014 {
00015   // ACE_TRACE ("ACE_SOCK_Stream::ACE_SOCK_Stream");
00016   this->set_handle (h);
00017 }

ASYS_INLINE ACE_SOCK_Stream::~ACE_SOCK_Stream void   
 

Destructor.

Definition at line 20 of file SOCK_Stream.i.

00021 {
00022   // ACE_TRACE ("ACE_SOCK_Stream::~ACE_SOCK_Stream");
00023 }


Member Function Documentation

int ACE_SOCK_Stream::close void   
 

Close down the socket (we need this to make things work correctly on Win32, which requires use to do a <close_writer> before doing the close to avoid losing data).

Reimplemented from ACE_SOCK.

Definition at line 22 of file SOCK_Stream.cpp.

References ACE_SOCK::close, and close_writer.

Referenced by ACE_Log_Msg_IPC::close, ACE_ATM_Stream::close, ACE_SOCK_Connector::complete, ACE_Service_Manager::handle_input, ACE_Pipe::open, ACE_SOCK_Connector::shared_connect_finish, ACE_SOCK_Connector::shared_connect_start, and ACE_Name_Proxy::~ACE_Name_Proxy.

00023 {
00024 #if defined (ACE_WIN32)
00025   // We need the following call to make things work correctly on
00026   // Win32, which requires use to do a <close_writer> before doing the
00027   // close in order to avoid losing data.  Note that we don't need to
00028   // do this on UNIX since it doesn't have this "feature".  Moreover,
00029   // this will cause subtle problems on UNIX due to the way that
00030   // fork() works.
00031   this->close_writer ();
00032 #endif /* ACE_WIN32 */
00033   // Close down the socket.
00034   return ACE_SOCK::close ();
00035 }

ASYS_INLINE int ACE_SOCK_Stream::close_reader void   
 

Close down the reader.

Definition at line 26 of file SOCK_Stream.i.

References ACE_SHUTDOWN_READ, ACE_TRACE, ACE_IPC_SAP::get_handle, and ACE_OS::shutdown.

00027 {
00028   ACE_TRACE ("ACE_SOCK_Stream::close_reader");
00029   if (this->get_handle () != ACE_INVALID_HANDLE)
00030     return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_READ);
00031   else
00032     return 0;
00033 }

ASYS_INLINE int ACE_SOCK_Stream::close_writer void   
 

Close down the writer.

Definition at line 38 of file SOCK_Stream.i.

References ACE_SHUTDOWN_WRITE, ACE_TRACE, ACE_IPC_SAP::get_handle, and ACE_OS::shutdown.

Referenced by close.

00039 {
00040   ACE_TRACE ("ACE_SOCK_Stream::close_writer");
00041   if (this->get_handle () != ACE_INVALID_HANDLE)
00042     return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_WRITE);
00043   else
00044     return 0;
00045 }

void ACE_SOCK_Stream::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_SOCK_IO.

Reimplemented in ACE_LSOCK_Stream.

Definition at line 16 of file SOCK_Stream.cpp.

References ACE_TRACE.

Referenced by ACE_Name_Proxy::dump, and ACE_LSOCK_Stream::dump.

00017 {
00018   ACE_TRACE ("ACE_SOCK_Stream::dump");
00019 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::recv_n void *    buf,
size_t    len,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Try to recv exactly <len> bytes into <buf> from the connected socket.

Definition at line 64 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::recv_n.

00068 {
00069   ACE_TRACE ("ACE_SOCK_Stream::recv_n");
00070   return ACE::recv_n (this->get_handle (),
00071                       buf,
00072                       len,
00073                       timeout,
00074                       bytes_transferred);
00075 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::recv_n void *    buf,
size_t    len,
int    flags,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Try to recv exactly <len> bytes into <buf> from the connected socket.

Definition at line 48 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::recv_n.

Referenced by ACE_Name_Proxy::request_reply.

00053 {
00054   ACE_TRACE ("ACE_SOCK_Stream::recv_n");
00055   return ACE::recv_n (this->get_handle (),
00056                       buf,
00057                       len,
00058                       flags,
00059                       timeout,
00060                       bytes_transferred);
00061 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::recv_urg void *    ptr,
size_t    len = sizeof(char),
const ACE_Time_Value   timeout = 0
const
 

Definition at line 161 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::recv.

00164 {
00165   ACE_TRACE ("ACE_SOCK_Stream::recv_urg");
00166   return ACE::recv (this->get_handle (),
00167                     ptr,
00168                     len,
00169                     MSG_OOB,
00170                     timeout);
00171 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::recvv_n iovec    iov[],
int    iovcnt,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Receive an <iovec> of size <iovcnt> from the connected socket.

Definition at line 78 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::recvv_n.

00082 {
00083   ACE_TRACE ("ACE_SOCK_Stream::recvv_n");
00084   return ACE::recvv_n (this->get_handle (),
00085                        iov,
00086                        n,
00087                        timeout,
00088                        bytes_transferred);
00089 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::send_n const ACE_Message_Block   message_block,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Send all the <message_block>s 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 136 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::send_n.

00139 {
00140   ACE_TRACE ("ACE_SOCK_Stream::send_n");
00141   return ACE::send_n (this->get_handle (),
00142                       message_block,
00143                       timeout,
00144                       bytes_transferred);
00145 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::send_n const void *    buf,
size_t    len,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Try to send exactly <len> bytes from <buf> to the connected socket.

Definition at line 108 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::send_n.

00112 {
00113   ACE_TRACE ("ACE_SOCK_Stream::send_n");
00114   return ACE::send_n (this->get_handle (),
00115                       buf,
00116                       len,
00117                       timeout,
00118                       bytes_transferred);
00119 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::send_n const void *    buf,
size_t    len,
int    flags,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Try to send exactly <len> bytes from <buf> to the connection socket.

Definition at line 92 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::send_n.

Referenced by ACE_Service_Manager::list_services, ACE_Log_Msg_IPC::log, ACE_Service_Manager::reconfigure_services, ACE_Remote_Token_Proxy::request_reply, ACE_Name_Proxy::request_reply, ACE_Log_Msg_IPC::reset, ACE_ATM_Stream::send_n, and ACE_Name_Proxy::send_request.

00097 {
00098   ACE_TRACE ("ACE_SOCK_Stream::send_n");
00099   return ACE::send_n (this->get_handle (),
00100                       buf,
00101                       len,
00102                       flags,
00103                       timeout,
00104                       bytes_transferred);
00105 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::send_urg const void *    ptr,
size_t    len = sizeof(char),
const ACE_Time_Value   timeout = 0
const
 

Definition at line 148 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::send.

00151 {
00152   ACE_TRACE ("ACE_SOCK_Stream::send_urg");
00153   return ACE::send (this->get_handle (),
00154                     ptr,
00155                     len,
00156                     MSG_OOB,
00157                     timeout);
00158 }

ASYS_INLINE ssize_t ACE_SOCK_Stream::sendv_n const iovec    iov[],
int    iovcnt,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Send an <iovec> of size <iovcnt> to the connected socket.

Definition at line 122 of file SOCK_Stream.i.

References ACE_TRACE, and ACE::sendv_n.

00126 {
00127   ACE_TRACE ("ACE_SOCK_Stream::sendv_n");
00128   return ACE::sendv_n (this->get_handle (),
00129                        iov,
00130                        n,
00131                        timeout,
00132                        bytes_transferred);
00133 }


Member Data Documentation

ACE_SOCK_Stream::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_SOCK_IO.

Reimplemented in ACE_LSOCK_Stream.

Definition at line 159 of file SOCK_Stream.h.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:56:27 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002