3 // $Id: IOStream_T.inl 80826 2008-03-04 14:51:23Z wotte $
5 #include "ace/Handle_Set.h"
6 #include "ace/OS_NS_errno.h"
7 #include "ace/OS_NS_sys_select.h"
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 template <class STREAM> ACE_INLINE int
12 ACE_IOStream<STREAM>::eof (void) const
14 // Get the timeout value of the streambuf
15 ACE_Time_Value *timeout = this->streambuf_->recv_timeout (0);
17 // Reset the timeout value of the streambuf.
18 (void) this->streambuf_->recv_timeout (timeout);
21 int rval = this->streambuf_->recv_n (&c,
26 // Timeout, not an eof
27 if (this->streambuf_->timeout())
30 // No timeout, got enough data: not eof
31 if (rval == sizeof(char))
34 // No timeout, not enough data: definately eof
38 template <class STREAM> ACE_INLINE
39 ACE_SOCK_Dgram_SC<STREAM>::ACE_SOCK_Dgram_SC (void)
43 template <class STREAM> ACE_INLINE
44 ACE_SOCK_Dgram_SC<STREAM>::ACE_SOCK_Dgram_SC (STREAM &source,
51 template <class STREAM> ACE_INLINE ssize_t
52 ACE_SOCK_Dgram_SC<STREAM>::send_n (char *buf,
55 return STREAM::send (buf, len, peer_);
58 template <class STREAM> ACE_INLINE ssize_t
59 ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
63 //FUZZ: disable check_for_lack_ACE_OS
64 return recv (buf, len, 0, tv);
65 //FUZZ: enable check_for_lack_ACE_OS
68 template <class STREAM> ACE_INLINE ssize_t
69 ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
76 ACE_HANDLE handle = this->get_handle ();
77 ACE_Handle_Set handle_set;
79 handle_set.set_bit (handle);
81 switch (ACE_OS::select (int (handle) + 1,
82 (fd_set *) handle_set, // read_fds.
83 (fd_set *) 0, // write_fds.
84 (fd_set *) 0, // exception_fds.
92 ; // Do the 'recv' below
96 int rval = STREAM::recv (buf, len, peer_, flags);
97 #if defined (ACE_WIN32)
98 if (rval == SOCKET_ERROR)
99 if (::WSAGetLastError () == WSAEMSGSIZE)
100 if (ACE_BIT_ENABLED (flags, MSG_PEEK))
102 #endif /* ACE_WIN32 */
103 return rval < len ? rval : len;
106 template <class STREAM> ACE_INLINE ssize_t
107 ACE_SOCK_Dgram_SC<STREAM>::recv_n (char *buf,
112 int rval = this->recv (buf, len, flags, tv);
116 template <class STREAM> ACE_INLINE int
117 ACE_SOCK_Dgram_SC<STREAM>::get_remote_addr (ACE_INET_Addr &addr) const
123 ACE_END_VERSIONED_NAMESPACE_DECL