3 //==========================================================================
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //==========================================================================
14 #include /**/ "ace/pre.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 * @brief Defines the methods for the ACE socket wrapper I/O routines
32 * If @a timeout == 0, then the call behaves as a normal
33 * send/recv call, i.e., for blocking sockets, the call will
34 * block until action is possible; for non-blocking sockets,
35 * -1 will be returned with errno == EWOULDBLOCK if no action is
36 * immediately possible.
37 * If @a timeout != 0, the call will wait until the relative time
38 * specified in *@a timeout elapses.
39 * Errors are reported by -1 and 0 return values. If the
40 * operation times out, -1 is returned with @c errno == ETIME.
41 * If it succeeds the number of bytes transferred is returned.
42 * Methods with the extra @a flags argument will always result in
43 * @c send getting called. Methods without the extra @a flags
44 * argument will result in @c send getting called on Win32
45 * platforms, and @c write getting called on non-Win32 platforms.
47 class ACE_Export ACE_SOCK_IO
: public ACE_SOCK
56 /// Recv an @a n byte buffer from the connected socket.
57 ssize_t
recv (void *buf
,
60 const ACE_Time_Value
*timeout
= 0) const;
62 /// Recv an @a n byte buffer from the connected socket.
63 ssize_t
recv (void *buf
,
65 const ACE_Time_Value
*timeout
= 0) const;
67 /// Recv an <iovec> of size @a n from the connected socket.
68 ssize_t
recvv (iovec iov
[],
70 const ACE_Time_Value
*timeout
= 0) const;
73 * Allows a client to read from a socket without having to provide a
74 * buffer to read. This method determines how much data is in the
75 * socket, allocates a buffer of this size, reads in the data, and
76 * returns the number of bytes read. The caller is responsible for
77 * deleting the member in the <iov_base> field of @a io_vec using
78 * delete [] io_vec->iov_base.
80 ssize_t
recvv (iovec
*io_vec
,
81 const ACE_Time_Value
*timeout
= 0) const;
83 #ifndef ACE_LACKS_VA_FUNCTIONS
84 /// Recv @a n varargs messages to the connected socket.
85 ssize_t
recv (size_t n
,
89 /// Recv @a n bytes via Win32 @c ReadFile using overlapped I/O.
90 ssize_t
recv (void *buf
,
92 ACE_OVERLAPPED
*overlapped
) const;
94 /// Send an @a n byte buffer to the connected socket.
95 ssize_t
send (const void *buf
,
98 const ACE_Time_Value
*timeout
= 0) const;
100 /// Send an @a n byte buffer to the connected socket.
101 ssize_t
send (const void *buf
,
103 const ACE_Time_Value
*timeout
= 0) const;
105 /// Send an @c iovec of size @a n to the connected socket.
106 ssize_t
sendv (const iovec iov
[],
108 const ACE_Time_Value
*timeout
= 0) const;
110 #ifndef ACE_LACKS_VA_FUNCTIONS
111 /// Send @a n varargs messages to the connected socket.
112 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.
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 */