3 //==========================================================================
7 * $Id: SOCK_IO.h 81014 2008-03-19 11:41:31Z johnnyw $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //==========================================================================
16 #include /**/ "ace/pre.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 * @brief Defines the methods for the ACE socket wrapper I/O routines
34 * If @a timeout == 0, then the call behaves as a normal
35 * send/recv call, i.e., for blocking sockets, the call will
36 * block until action is possible; for non-blocking sockets,
37 * -1 will be returned with errno == EWOULDBLOCK if no action is
38 * immediately possible.
39 * If @a timeout != 0, the call will wait until the relative time
40 * specified in *@a timeout elapses.
41 * Errors are reported by -1 and 0 return values. If the
42 * operation times out, -1 is returned with @c errno == ETIME.
43 * If it succeeds the number of bytes transferred is returned.
44 * Methods with the extra @a flags argument will always result in
45 * @c send getting called. Methods without the extra @a flags
46 * argument will result in @c send getting called on Win32
47 * platforms, and @c write getting called on non-Win32 platforms.
49 class ACE_Export ACE_SOCK_IO
: public ACE_SOCK
52 // = Initialization and termination methods.
60 /// Recv an @a n byte buffer from the connected socket.
61 ssize_t
recv (void *buf
,
64 const ACE_Time_Value
*timeout
= 0) const;
66 /// Recv an @a n byte buffer from the connected socket.
67 ssize_t
recv (void *buf
,
69 const ACE_Time_Value
*timeout
= 0) const;
71 /// Recv an <iovec> of size @a n from the connected socket.
72 ssize_t
recvv (iovec iov
[],
74 const ACE_Time_Value
*timeout
= 0) const;
77 * Allows a client to read from a socket without having to provide a
78 * buffer to read. This method determines how much data is in the
79 * socket, allocates a buffer of this size, reads in the data, and
80 * returns the number of bytes read. The caller is responsible for
81 * deleting the member in the <iov_base> field of @a io_vec using
82 * delete [] io_vec->iov_base.
84 ssize_t
recvv (iovec
*io_vec
,
85 const ACE_Time_Value
*timeout
= 0) const;
87 /// Recv @a n varargs messages to the connected socket.
88 ssize_t
recv (size_t n
,
91 /// Recv @a n bytes via Win32 @c ReadFile using overlapped I/O.
92 ssize_t
recv (void *buf
,
94 ACE_OVERLAPPED
*overlapped
) const;
96 /// Send an @a n byte buffer to the connected socket.
97 ssize_t
send (const void *buf
,
100 const ACE_Time_Value
*timeout
= 0) const;
102 /// Send an @a n byte buffer to the connected socket.
103 ssize_t
send (const void *buf
,
105 const ACE_Time_Value
*timeout
= 0) const;
107 /// Send an @c iovec of size @a n to the connected socket.
108 ssize_t
sendv (const iovec iov
[],
110 const ACE_Time_Value
*timeout
= 0) const;
112 /// Send @a n varargs messages to the connected socket.
113 ssize_t
send (size_t n
,
116 /// Send @a n bytes via Win32 <WriteFile> using overlapped I/O.
117 ssize_t
send (const void *buf
,
119 ACE_OVERLAPPED
*overlapped
) const;
121 /// Dump the state of an object.
122 void dump (void) const;
124 /// Declare the dynamic allocation hooks.
125 ACE_ALLOC_HOOK_DECLARE
;
128 ACE_END_VERSIONED_NAMESPACE_DECL
130 #if defined (__ACE_INLINE__)
131 #include "ace/SOCK_IO.inl"
132 #endif /* __ACE_INLINE__ */
134 #include /**/ "ace/post.h"
136 #endif /* ACE_SOCK_IO_H */