#include <SOCK_IO.h>
Inheritance diagram for ACE_SOCK_IO:
Public Member Functions | |
ACE_SOCK_IO (void) | |
Constructor. | |
~ACE_SOCK_IO (void) | |
Destructor. | |
ssize_t | recv (void *buf, size_t n, int flags, const ACE_Time_Value *timeout=0) const |
Recv an byte buffer from the connected socket. | |
ssize_t | recv (void *buf, size_t n, const ACE_Time_Value *timeout=0) const |
Recv an byte buffer from the connected socket. | |
ssize_t | recvv (iovec iov[], size_t n, const ACE_Time_Value *timeout=0) const |
Recv an of size from the connected socket. | |
ssize_t | recv (iovec iov[], size_t n, const ACE_Time_Value *timeout=0) const |
ssize_t | recvv (iovec *io_vec, const ACE_Time_Value *timeout=0) const |
ssize_t | recv (iovec *io_vec, const ACE_Time_Value *timeout=0) const |
Same as above. Deprecated. | |
ssize_t | recv (size_t n,...) const |
Recv varargs messages to the connected socket. | |
ssize_t | recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const |
Recv bytes via Win32 using overlapped I/O. | |
ssize_t | send (const void *buf, size_t n, int flags, const ACE_Time_Value *timeout=0) const |
Send an byte buffer to the connected socket. | |
ssize_t | send (const void *buf, size_t n, const ACE_Time_Value *timeout=0) const |
Send an byte buffer to the connected socket. | |
ssize_t | sendv (const iovec iov[], size_t n, const ACE_Time_Value *timeout=0) const |
Send an of size to the connected socket. | |
ssize_t | send (const iovec iov[], size_t n, const ACE_Time_Value *timeout=0) const |
Same as above. Deprecated. | |
ssize_t | send (size_t n,...) const |
Send varargs messages to the connected socket. | |
ssize_t | send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const |
Send bytes via Win32 using overlapped I/O. | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. |
If == 0, then the call behaves as a normal send/recv call, i.e., for blocking sockets, the call will block until action is possible; for non-blocking sockets, EWOULDBLOCK will be returned if no action is immediately possible. If != 0, the call will wait until the relative time specified in * elapses. Errors are reported by -1 and 0 return values. If the operation times out, -1 is returned with <errno == ETIME>. If it succeeds the number of bytes transferred is returned. Methods with the extra argument will always result in getting called. Methods without the extra argument will result in getting called on Win32 platforms, and getting called on non-Win32 platforms.
Definition at line 50 of file SOCK_IO.h.
|
Constructor.
Definition at line 13 of file SOCK_IO.inl.
00014 {
00015 // ACE_TRACE ("ACE_SOCK_IO::ACE_SOCK_IO");
00016 }
|
|
Destructor.
Definition at line 19 of file SOCK_IO.inl.
00020 {
00021 // ACE_TRACE ("ACE_SOCK_IO::~ACE_SOCK_IO");
00022 }
|
|
Dump the state of an object.
Reimplemented from ACE_SOCK. Reimplemented in ACE_LSOCK_CODgram, ACE_LSOCK_Stream, ACE_SOCK_CODgram, ACE_SOCK_SEQPACK_Association, and ACE_SOCK_Stream. Definition at line 22 of file SOCK_IO.cpp. References ACE_TRACE.
00023 { 00024 #if defined (ACE_HAS_DUMP) 00025 ACE_TRACE ("ACE_SOCK_IO::dump"); 00026 #endif /* ACE_HAS_DUMP */ 00027 } |
|
Recv bytes via Win32 using overlapped I/O.
Definition at line 83 of file SOCK_IO.inl. References ACE_OVERLAPPED, ACE_TRACE, and ACE_OS::read().
00086 { 00087 ACE_TRACE ("ACE_SOCK_IO::recv"); 00088 return ACE_OS::read (this->get_handle (), 00089 (char *) buf, 00090 n, 00091 overlapped); 00092 } |
|
Recv varargs messages to the connected socket.
Definition at line 148 of file SOCK_IO.cpp. References ACE_NEW_RETURN, ACE_TRACE, iovec::iov_base, iovec::iov_len, ACE_OS::recvv(), and ssize_t.
00149 { 00150 ACE_TRACE ("ACE_SOCK_IO::recv"); 00151 00152 va_list argp; 00153 int total_tuples = ACE_Utils::Truncate<size_t> (n / 2); 00154 iovec *iovp; 00155 #if defined (ACE_HAS_ALLOCA) 00156 iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); 00157 #else 00158 ACE_NEW_RETURN (iovp, 00159 iovec[total_tuples], 00160 -1); 00161 #endif /* !defined (ACE_HAS_ALLOCA) */ 00162 00163 va_start (argp, n); 00164 00165 for (int i = 0; i < total_tuples; i++) 00166 { 00167 iovp[i].iov_base = va_arg (argp, char *); 00168 iovp[i].iov_len = va_arg (argp, int); 00169 } 00170 00171 ssize_t result = ACE_OS::recvv (this->get_handle (), 00172 iovp, 00173 total_tuples); 00174 #if !defined (ACE_HAS_ALLOCA) 00175 delete [] iovp; 00176 #endif /* !defined (ACE_HAS_ALLOCA) */ 00177 va_end (argp); 00178 return result; 00179 } |
|
Same as above. Deprecated.
Definition at line 74 of file SOCK_IO.inl. References ACE_TRACE, and recvv().
|
|
Definition at line 63 of file SOCK_IO.inl. References ACE_TRACE, and recvv().
|
|
Recv an byte buffer from the connected socket.
Definition at line 39 of file SOCK_IO.inl. References ACE_TRACE, and ACE::recv().
|
|
Recv an byte buffer from the connected socket.
Definition at line 25 of file SOCK_IO.inl. References ACE_TRACE, and ACE::recv(). Referenced by ACE_Service_Manager::handle_input(), ACE_Name_Proxy::recv_reply(), recvv(), and ACE_Remote_Token_Proxy::request_reply().
|
|
Allows a client to read from a socket without having to provide a buffer to read. This method determines how much data is in the socket, allocates a buffer of this size, reads in the data, and returns the number of bytes read. The caller is responsible for deleting the member in the field of using delete [] io_vec->iov_base. Definition at line 35 of file SOCK_IO.cpp. References ACE_NEW_RETURN, ACE_NOTSUP_RETURN, ACE_TRACE, ETIME, ACE_OS::ioctl(), iovec::iov_base, iovec::iov_len, recv(), ACE_Handle_Set::reset(), ACE_OS::select(), ACE_Handle_Set::set_bit(), and ssize_t.
00037 { 00038 ACE_TRACE ("ACE_SOCK_IO::recvv"); 00039 #if defined (FIONREAD) 00040 ACE_Handle_Set handle_set; 00041 handle_set.reset (); 00042 handle_set.set_bit (this->get_handle ()); 00043 00044 io_vec->iov_base = 0; 00045 00046 // Check the status of the current socket. 00047 int select_width; 00048 # if defined (ACE_WIN32) 00049 // This arg is ignored on Windows and causes pointer truncation 00050 // warnings on 64-bit compiles. 00051 select_width = 0; 00052 # else 00053 select_width = int (this->get_handle ()) + 1; 00054 # endif /* ACE_WIN32 */ 00055 switch (ACE_OS::select (select_width, 00056 handle_set, 00057 0, 0, 00058 timeout)) 00059 { 00060 case -1: 00061 return -1; 00062 /* NOTREACHED */ 00063 case 0: 00064 errno = ETIME; 00065 return -1; 00066 /* NOTREACHED */ 00067 default: 00068 // Goes fine, fallthrough to get data 00069 break; 00070 } 00071 00072 int inlen = 0; 00073 00074 if (ACE_OS::ioctl (this->get_handle (), 00075 FIONREAD, 00076 &inlen) == -1) 00077 return -1; 00078 else if (inlen > 0) 00079 { 00080 ACE_NEW_RETURN (io_vec->iov_base, 00081 char[inlen], 00082 -1); 00083 // It's ok to blindly cast this value since 'inlen' is an int and, thus, 00084 // we can't get more than that back. Besides, if the recv() fails, we 00085 // don't want that value cast to unsigned and returned. 00086 ssize_t recv_len = this->recv (io_vec->iov_base, inlen); 00087 if (recv_len > 0) 00088 // u_long is the Windows type; size_t is everyone else's. A u_long 00089 // should go into a size_t anywhere without an issue. 00090 io_vec->iov_len = static_cast<u_long> (recv_len); 00091 return recv_len; 00092 } 00093 else 00094 return 0; 00095 #else 00096 ACE_UNUSED_ARG (io_vec); 00097 ACE_UNUSED_ARG (timeout); 00098 ACE_NOTSUP_RETURN (-1); 00099 #endif /* FIONREAD */ 00100 } |
|
Recv an of size from the connected socket.
Definition at line 51 of file SOCK_IO.inl. References ACE_TRACE, and ACE::recvv(). Referenced by recv().
00054 { 00055 ACE_TRACE ("ACE_SOCK_IO::recvv"); 00056 return ACE::recvv (this->get_handle (), 00057 iov, 00058 ACE_Utils::Truncate<size_t> (n), 00059 timeout); 00060 } |
|
Send bytes via Win32 using overlapped I/O.
Definition at line 144 of file SOCK_IO.inl. References ACE_OVERLAPPED, ACE_TRACE, and ACE_OS::write().
00147 { 00148 ACE_TRACE ("ACE_SOCK_IO::send"); 00149 return ACE_OS::write (this->get_handle (), 00150 buf, 00151 n, 00152 overlapped); 00153 } |
|
Send varargs messages to the connected socket.
Definition at line 108 of file SOCK_IO.cpp. References ACE_NEW_RETURN, ACE_TRACE, iovec::iov_base, iovec::iov_len, ACE_OS::sendv(), and ssize_t.
00109 { 00110 ACE_TRACE ("ACE_SOCK_IO::send"); 00111 00112 va_list argp; 00113 int total_tuples = ACE_Utils::Truncate<size_t> (n / 2); 00114 iovec *iovp = 0; 00115 #if defined (ACE_HAS_ALLOCA) 00116 iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); 00117 #else 00118 ACE_NEW_RETURN (iovp, 00119 iovec[total_tuples], 00120 -1); 00121 #endif /* !defined (ACE_HAS_ALLOCA) */ 00122 00123 va_start (argp, n); 00124 00125 for (int i = 0; i < total_tuples; i++) 00126 { 00127 iovp[i].iov_base = va_arg (argp, char *); 00128 iovp[i].iov_len = va_arg (argp, int); 00129 } 00130 00131 ssize_t result = ACE_OS::sendv (this->get_handle (), 00132 iovp, 00133 total_tuples); 00134 #if !defined (ACE_HAS_ALLOCA) 00135 delete [] iovp; 00136 #endif /* !defined (ACE_HAS_ALLOCA) */ 00137 va_end (argp); 00138 return result; 00139 } |
|
Same as above. Deprecated.
Definition at line 133 of file SOCK_IO.inl. References ACE_TRACE, and sendv().
|
|
Send an byte buffer to the connected socket.
Definition at line 109 of file SOCK_IO.inl. References ACE_TRACE, and ACE::send().
|
|
Send an byte buffer to the connected socket.
Definition at line 95 of file SOCK_IO.inl. References ACE_TRACE, and ACE::send().
|
|
Send an of size to the connected socket.
Definition at line 121 of file SOCK_IO.inl. References ACE_TRACE, and ACE::sendv(). Referenced by send().
00124 { 00125 ACE_TRACE ("ACE_SOCK_IO::sendv"); 00126 return ACE::sendv (this->get_handle (), 00127 iov, 00128 ACE_Utils::Truncate<size_t> (n), 00129 timeout); 00130 } |
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_SOCK. Reimplemented in ACE_LSOCK_CODgram, ACE_LSOCK_Stream, ACE_SOCK_CODgram, ACE_SOCK_SEQPACK_Association, and ACE_SOCK_Stream. |