gnuace: use list of generated files from GENERATED_DIRTY for ADDITIONAL_IDL_TARGETS
[ACE_TAO.git] / ACE / ace / SOCK_IO.h
blob538bec97ce442cd32238445f790d63f80080b8f2
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file SOCK_IO.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //==========================================================================
11 #ifndef ACE_SOCK_IO_H
12 #define ACE_SOCK_IO_H
14 #include /**/ "ace/pre.h"
16 #include "ace/SOCK.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/ACE.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 /**
27 * @class ACE_SOCK_IO
29 * @brief Defines the methods for the ACE socket wrapper I/O routines
30 * described below.
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
49 public:
50 // = Initialization and termination methods.
52 /// Constructor.
53 ACE_SOCK_IO (void);
55 /// Destructor.
56 ~ACE_SOCK_IO (void);
58 /// Recv an @a n byte buffer from the connected socket.
59 ssize_t recv (void *buf,
60 size_t n,
61 int flags,
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,
66 size_t n,
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[],
71 int n,
72 const ACE_Time_Value *timeout = 0) const;
74 /**
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,
88 ...) const;
89 #endif
91 /// Recv @a n bytes via Win32 @c ReadFile using overlapped I/O.
92 ssize_t recv (void *buf,
93 size_t n,
94 ACE_OVERLAPPED *overlapped) const;
96 /// Send an @a n byte buffer to the connected socket.
97 ssize_t send (const void *buf,
98 size_t n,
99 int flags,
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,
104 size_t n,
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[],
109 int n,
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,
115 ...) const;
116 #endif
118 /// Send @a n bytes via Win32 <WriteFile> using overlapped I/O.
119 ssize_t send (const void *buf,
120 size_t n,
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 */