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
50 // = Initialization and termination methods.
58 /// Recv an @a n byte buffer from the connected socket.
59 ssize_t
recv (void *buf
,
62 const ACE_Time_Value
*timeout
= 0) const;
64 /// Recv an @a n byte buffer from the connected socket.
65 ssize_t
recv (void *buf
,
67 const ACE_Time_Value
*timeout
= 0) const;
69 /// Recv an <iovec> of size @a n from the connected socket.
70 ssize_t
recvv (iovec iov
[],
72 const ACE_Time_Value
*timeout
= 0) const;
75 * Allows a client to read from a socket without having to provide a
76 * buffer to read. This method determines how much data is in the
77 * socket, allocates a buffer of this size, reads in the data, and
78 * returns the number of bytes read. The caller is responsible for
79 * deleting the member in the <iov_base> field of @a io_vec using
80 * delete [] io_vec->iov_base.
82 ssize_t
recvv (iovec
*io_vec
,
83 const ACE_Time_Value
*timeout
= 0) const;
85 #ifndef ACE_LACKS_VA_FUNCTIONS
86 /// Recv @a n varargs messages to the connected socket.
87 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 #ifndef ACE_LACKS_VA_FUNCTIONS
113 /// Send @a n varargs messages to the connected socket.
114 ssize_t
send (size_t n
,
118 /// Send @a n bytes via Win32 <WriteFile> using overlapped I/O.
119 ssize_t
send (const void *buf
,
121 ACE_OVERLAPPED
*overlapped
) const;
123 /// Dump the state of an object.
124 void dump (void) const;
126 /// Declare the dynamic allocation hooks.
127 ACE_ALLOC_HOOK_DECLARE
;
130 ACE_END_VERSIONED_NAMESPACE_DECL
132 #if defined (__ACE_INLINE__)
133 #include "ace/SOCK_IO.inl"
134 #endif /* __ACE_INLINE__ */
136 #include /**/ "ace/post.h"
138 #endif /* ACE_SOCK_IO_H */