ACE_SOCK_Dgram_SC< STREAM > Class Template Reference

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

#include <IOStream_T.h>

Collaboration diagram for ACE_SOCK_Dgram_SC< STREAM >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 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=0)
ssize_t recv (char *buf, ssize_t len, int flags, ACE_Time_Value *tv=0)
ssize_t recv_n (char *buf, ssize_t len, int flags=0, ACE_Time_Value *tv=0)
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 257 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 39 of file IOStream_T.inl.

00040 {
00041 }

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

Definition at line 44 of file IOStream_T.inl.

00046   : STREAM (source),
00047     peer_ (dest)
00048 {
00049 }


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 115 of file IOStream_T.inl.

00116 {
00117   addr = peer_;
00118   return 0;
00119 }

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

Definition at line 67 of file IOStream_T.inl.

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

00071 {
00072   if (tv != 0)
00073     {
00074       ACE_HANDLE handle = this->get_handle ();
00075       ACE_Handle_Set handle_set;
00076 
00077       handle_set.set_bit (handle);
00078 
00079       switch (ACE_OS::select (int (handle) + 1,
00080                               (fd_set *) handle_set, // read_fds.
00081                               (fd_set *) 0,          // write_fds.
00082                               (fd_set *) 0,          // exception_fds.
00083                               tv))
00084         {
00085         case 0:
00086           errno = ETIME;
00087         case -1:
00088           return -1;
00089         default:
00090           ;     // Do the 'recv' below
00091         }
00092     }
00093 
00094   int rval = STREAM::recv (buf, len, peer_, flags);
00095 #if defined (ACE_WIN32)
00096   if (rval == SOCKET_ERROR)
00097     if (::WSAGetLastError () == WSAEMSGSIZE)
00098       if (ACE_BIT_ENABLED (flags, MSG_PEEK))
00099         rval = len;
00100 #endif /* ACE_WIN32 */
00101   return rval < len ? rval : len;
00102 }

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

Definition at line 59 of file IOStream_T.inl.

References ssize_t.

Referenced by ACE_SOCK_Dgram_SC< STREAM >::recv_n().

00062 {
00063   return recv (buf, len, 0, tv);
00064 }

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 = 0
 

Definition at line 105 of file IOStream_T.inl.

References ACE_SOCK_Dgram_SC< STREAM >::recv(), and ssize_t.

00109 {
00110   int rval = this->recv (buf, len, flags, tv);
00111   return rval;
00112 }

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

Definition at line 52 of file IOStream_T.inl.

References ssize_t.

00054 {
00055   return STREAM::send (buf, len, peer_);
00056 }


Member Data Documentation

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

Definition at line 278 of file IOStream_T.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:29:53 2006 for ACE by doxygen 1.3.6