#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 n byte buffer from the connected socket. | |
ssize_t | recv (void *buf, size_t n, const ACE_Time_Value *timeout=0) const |
Recv an n byte buffer from the connected socket. | |
ssize_t | recvv (iovec iov[], int n, const ACE_Time_Value *timeout=0) const |
Recv an of size n from the connected socket. | |
ssize_t | recvv (iovec *io_vec, const ACE_Time_Value *timeout=0) const |
ssize_t | recv (size_t n,...) const |
Recv n varargs messages to the connected socket. | |
ssize_t | recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const |
Recv n 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 n byte buffer to the connected socket. | |
ssize_t | send (const void *buf, size_t n, const ACE_Time_Value *timeout=0) const |
Send an n byte buffer to the connected socket. | |
ssize_t | sendv (const iovec iov[], int n, const ACE_Time_Value *timeout=0) const |
Send an of size n to the connected socket. | |
ssize_t | send (size_t n,...) const |
Send n varargs messages to the connected socket. | |
ssize_t | send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const |
Send n 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 timeout == 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, -1 will be returned with errno == EWOULDBLOCK if no action is immediately possible. If timeout != 0, the call will wait until the relative time specified in *timeout 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 49 of file SOCK_IO.h.
|
Constructor.
Definition at line 12 of file SOCK_IO.inl.
00013 {
00014 // ACE_TRACE ("ACE_SOCK_IO::ACE_SOCK_IO");
00015 }
|
|
Destructor.
Definition at line 18 of file SOCK_IO.inl.
00019 {
00020 // ACE_TRACE ("ACE_SOCK_IO::~ACE_SOCK_IO");
00021 }
|
|
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 n bytes via Win32 using overlapped I/O.
Definition at line 62 of file SOCK_IO.inl. References ACE_OVERLAPPED, ACE_TRACE, and ACE_OS::read().
00065 { 00066 ACE_TRACE ("ACE_SOCK_IO::recv"); 00067 return ACE_OS::read (this->get_handle (), 00068 (char *) buf, 00069 n, 00070 overlapped); 00071 } |
|
Recv n varargs messages to the connected socket.
Definition at line 148 of file SOCK_IO.cpp. References ACE_NEW_RETURN, ACE_TRACE, 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_cast<int> (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 } |
|
Recv an n byte buffer from the connected socket.
Definition at line 38 of file SOCK_IO.inl. References ACE_TRACE, and ACE::recv().
|
|
Recv an n byte buffer from the connected socket.
Definition at line 24 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(), 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 n from the connected socket.
Definition at line 50 of file SOCK_IO.inl. References ACE_TRACE, and ACE::recvv().
00053 { 00054 ACE_TRACE ("ACE_SOCK_IO::recvv"); 00055 return ACE::recvv (this->get_handle (), 00056 iov, 00057 n, 00058 timeout); 00059 } |
|
Send n bytes via Win32 using overlapped I/O.
Definition at line 112 of file SOCK_IO.inl. References ACE_OVERLAPPED, ACE_TRACE, and ACE_OS::write().
00115 { 00116 ACE_TRACE ("ACE_SOCK_IO::send"); 00117 return ACE_OS::write (this->get_handle (), 00118 buf, 00119 n, 00120 overlapped); 00121 } |
|
Send n varargs messages to the connected socket.
Definition at line 108 of file SOCK_IO.cpp. References ACE_NEW_RETURN, ACE_TRACE, 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_cast<int> (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 } |
|
Send an n byte buffer to the connected socket.
Definition at line 88 of file SOCK_IO.inl. References ACE_TRACE, and ACE::send().
|
|
Send an n byte buffer to the connected socket.
Definition at line 74 of file SOCK_IO.inl. References ACE_TRACE, and ACE::send().
|
|
Send an of size n to the connected socket.
Definition at line 100 of file SOCK_IO.inl. References ACE_TRACE, and ACE::sendv().
00103 { 00104 ACE_TRACE ("ACE_SOCK_IO::sendv"); 00105 return ACE::sendv (this->get_handle (), 00106 iov, 00107 n, 00108 timeout); 00109 } |
|
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. |