2 #include "ace/Handle_Set.h"
3 #include "ace/OS_NS_errno.h"
4 #include "ace/OS_NS_sys_select.h"
6 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
8 template <class STREAM> ACE_INLINE int
9 ACE_IOStream<STREAM>::eof () const
11 // Get the timeout value of the streambuf
12 ACE_Time_Value *timeout = this->streambuf_->recv_timeout (0);
14 // Reset the timeout value of the streambuf.
15 (void) this->streambuf_->recv_timeout (timeout);
18 int rval = this->streambuf_->recv_n (&c,
23 // Timeout, not an eof
24 if (this->streambuf_->timeout())
27 // No timeout, got enough data: not eof
28 if (rval == sizeof(char))
31 // No timeout, not enough data: definately eof
35 template <class STREAM> ACE_INLINE
36 ACE_SOCK_Dgram_SC<STREAM>::ACE_SOCK_Dgram_SC ()
40 template <class STREAM> ACE_INLINE
41 ACE_SOCK_Dgram_SC<STREAM>::ACE_SOCK_Dgram_SC (STREAM &source,
48 template <class STREAM> ACE_INLINE ssize_t
49 ACE_SOCK_Dgram_SC<STREAM>::send_n (char *buf,
52 return STREAM::send (buf, len, peer_);
55 template <class STREAM> ACE_INLINE ssize_t
56 ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
60 //FUZZ: disable check_for_lack_ACE_OS
61 return recv (buf, len, 0, tv);
62 //FUZZ: enable check_for_lack_ACE_OS
65 template <class STREAM> ACE_INLINE ssize_t
66 ACE_SOCK_Dgram_SC<STREAM>::recv (char *buf,
73 ACE_HANDLE handle = this->get_handle ();
74 ACE_Handle_Set handle_set;
76 handle_set.set_bit (handle);
78 switch (ACE_OS::select (int (handle) + 1,
79 (fd_set *) handle_set, // read_fds.
80 (fd_set *) 0, // write_fds.
81 (fd_set *) 0, // exception_fds.
89 ; // Do the 'recv' below
93 int rval = STREAM::recv (buf, len, peer_, flags);
94 #if defined (ACE_WIN32)
95 if (rval == SOCKET_ERROR)
96 if (::WSAGetLastError () == WSAEMSGSIZE)
97 if (ACE_BIT_ENABLED (flags, MSG_PEEK))
99 #endif /* ACE_WIN32 */
100 return rval < len ? rval : len;
103 template <class STREAM> ACE_INLINE ssize_t
104 ACE_SOCK_Dgram_SC<STREAM>::recv_n (char *buf,
109 int rval = this->recv (buf, len, flags, tv);
113 template <class STREAM> ACE_INLINE int
114 ACE_SOCK_Dgram_SC<STREAM>::get_remote_addr (ACE_INET_Addr &addr) const
120 ACE_END_VERSIONED_NAMESPACE_DECL