Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_SOCK_Dgram_SC Class Template Reference

"Dgram_SC" is short for "Datagram Self-Contained.". More...

#include <IOStream_T.h>

Collaboration diagram for ACE_SOCK_Dgram_SC:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_SOCK_Dgram_SC (void)
 ACE_SOCK_Dgram_SC (STREAM &source, ACE_INET_Addr &dest)
ssize_t send_n (char *buf, ssize_t len)
ssize_t recv (char *buf, ssize_t len, ACE_Time_Value *tv=NULL)
ssize_t recv (char *buf, ssize_t len, int flags, ACE_Time_Value *tv=NULL)
ssize_t recv_n (char *buf, ssize_t len, int flags=0, ACE_Time_Value *tv=NULL)
int get_remote_addr (ACE_INET_Addr &addr) const

Protected Attributes

ACE_INET_Addr peer_

Detailed Description

template<class STREAM>
class ACE_SOCK_Dgram_SC< STREAM >

"Dgram_SC" is short for "Datagram Self-Contained.".

Datagrams don't have the notion of a "peer". Each send and receive on a datagram can go to a different peer if you want. If you're using datagrams for stream activity, you probably want 'em all to go to (and come from) the same place. That's what this class is for. Here, we keep an address object so that we can remember who last sent us data. When we write back, we're then able to write back to that same address.

Definition at line 251 of file IOStream_T.h.


Constructor & Destructor Documentation

template<class STREAM>
ACE_INLINE ACE_SOCK_Dgram_SC< STREAM >::ACE_SOCK_Dgram_SC void   
 

Definition at line 80 of file IOStream_T.i.

00081 {
00082 }

template<class STREAM>
ACE_INLINE ACE_SOCK_Dgram_SC< STREAM >::ACE_SOCK_Dgram_SC STREAM &    source,
ACE_INET_Addr   dest
 

Definition at line 85 of file IOStream_T.i.

00087   : STREAM (source),
00088     peer_ (dest)
00089 {
00090 }


Member Function Documentation

template<class STREAM>
ACE_INLINE int ACE_SOCK_Dgram_SC< STREAM >::get_remote_addr ACE_INET_Addr   addr const
 

Definition at line 156 of file IOStream_T.i.

References peer_.

00157 {
00158   addr = peer_;
00159   return 0;
00160 }

template<class STREAM>
ACE_INLINE ssize_t ACE_SOCK_Dgram_SC< STREAM >::recv char *    buf,
ssize_t    len,
int    flags,
ACE_Time_Value   tv = NULL
 

Definition at line 108 of file IOStream_T.i.

References ACE_BIT_ENABLED, ETIME, peer_, ACE_OS::select, ACE_Handle_Set::set_bit, and ssize_t.

00112 {
00113   if (tv != 0)
00114     {
00115       ACE_HANDLE handle = this->get_handle ();
00116       ACE_Handle_Set handle_set;
00117 
00118       handle_set.set_bit (handle);
00119 
00120       switch (ACE_OS::select (int (handle) + 1,
00121                               (fd_set *) handle_set, // read_fds.
00122                               (fd_set *) 0,          // write_fds.
00123                               (fd_set *) 0,          // exception_fds.
00124                               tv))
00125         {
00126         case 0:
00127           errno = ETIME;
00128         case -1:
00129           return -1;
00130         default:
00131           ;     // Do the 'recv' below
00132         }
00133     }
00134 
00135   int rval = STREAM::recv (buf, len, peer_, flags);
00136 #if defined (ACE_WIN32)
00137   if (rval == SOCKET_ERROR)
00138     if (::WSAGetLastError () == WSAEMSGSIZE)
00139       if (ACE_BIT_ENABLED (flags, MSG_PEEK))
00140         rval = len;
00141 #endif /* ACE_WIN32 */
00142   return rval < len ? rval : len;
00143 }

template<class STREAM>
ACE_INLINE ssize_t ACE_SOCK_Dgram_SC< STREAM >::recv char *    buf,
ssize_t    len,
ACE_Time_Value   tv = NULL
 

Definition at line 100 of file IOStream_T.i.

References ssize_t.

Referenced by recv_n.

00103 {
00104   return recv (buf, len, 0, tv);
00105 }

template<class STREAM>
ACE_INLINE ssize_t ACE_SOCK_Dgram_SC< STREAM >::recv_n char *    buf,
ssize_t    len,
int    flags = 0,
ACE_Time_Value   tv = NULL
 

Definition at line 146 of file IOStream_T.i.

References recv, and ssize_t.

00150 {
00151   int rval = this->recv (buf, len, flags, tv);
00152   return rval;
00153 }

template<class STREAM>
ACE_INLINE ssize_t ACE_SOCK_Dgram_SC< STREAM >::send_n char *    buf,
ssize_t    len
 

Definition at line 93 of file IOStream_T.i.

References peer_, and ssize_t.

00095 {
00096   return STREAM::send (buf, len, peer_);
00097 }


Member Data Documentation

template<class STREAM>
ACE_INET_Addr ACE_SOCK_Dgram_SC::peer_ [protected]
 

Definition at line 272 of file IOStream_T.h.

Referenced by get_remote_addr, recv, and send_n.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:56:24 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002