Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / SOCK_IO.h
blobee1f460f4b1b44b7fbaf86dd3ebb49336d5e3afb
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 /// Constructor.
51 ACE_SOCK_IO ();
53 /// Destructor.
54 ~ACE_SOCK_IO ();
56 /// Recv an @a n byte buffer from the connected socket.
57 ssize_t recv (void *buf,
58 size_t n,
59 int flags,
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,
64 size_t n,
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[],
69 int n,
70 const ACE_Time_Value *timeout = 0) const;
72 /**
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,
86 ...) const;
87 #endif
89 /// Recv @a n bytes via Win32 @c ReadFile using overlapped I/O.
90 ssize_t recv (void *buf,
91 size_t n,
92 ACE_OVERLAPPED *overlapped) const;
94 /// Send an @a n byte buffer to the connected socket.
95 ssize_t send (const void *buf,
96 size_t n,
97 int flags,
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,
102 size_t n,
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[],
107 int n,
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,
113 ...) const;
114 #endif
116 /// Send @a n bytes via Win32 <WriteFile> using overlapped I/O.
117 ssize_t send (const void *buf,
118 size_t n,
119 ACE_OVERLAPPED *overlapped) const;
121 /// Dump the state of an object.
122 void dump () 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 */