1 /* Defines the member functions for the base class of the ACE_TLI_Stream
4 #include "ace/TLI_Stream.h"
6 #include "ace/OS_NS_unistd.h"
10 #if defined (ACE_HAS_TLI)
12 #if !defined (__ACE_INLINE__)
13 #include "ace/TLI_Stream.inl"
14 #endif /* __ACE_INLINE__ */
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Stream
)
21 ACE_TLI_Stream::dump (void) const
23 #if defined (ACE_HAS_DUMP)
24 ACE_TRACE ("ACE_TLI_Stream::dump");
25 #endif /* ACE_HAS_DUMP */
28 ACE_TLI_Stream::ACE_TLI_Stream (void)
31 ACE_TRACE ("ACE_TLI_Stream::ACE_TLI_Stream");
35 ACE_TLI_Stream::get_remote_addr (ACE_Addr
&sa
) const
37 ACE_TRACE ("ACE_TLI_Stream::get_remote_addr");
40 name
.maxlen
= sa
.get_size ();
41 name
.buf
= (char *) sa
.get_addr ();
43 if (ACE_OS::t_getname (this->get_handle (), &name
, REMOTENAME
) == -1)
49 // Send a release and then await the release from the other side.
52 ACE_TLI_Stream::active_close (void)
54 ACE_TRACE ("ACE_TLI_Stream::active_close");
57 if (this->sndrel () == -1)
59 else if (this->recv (&buf
, sizeof buf
) == -1)
61 if (t_errno
== TLOOK
&& this->look () == T_ORDREL
)
63 if (this->rcvrel () == -1)
70 return this->close ();
73 // Acknowledge the release from the other side and then send the
74 // release to the other side.
77 ACE_TLI_Stream::passive_close (void)
79 ACE_TRACE ("ACE_TLI_Stream::passive_close");
81 if (this->rcvrel () == -1)
83 else if (this->sndrel () == -1)
86 return this->close ();
90 ACE_TLI_Stream::close (void)
92 ACE_TRACE ("ACE_TLI_Stream::close");
94 ACE_HANDLE fd
= this->get_handle ();
96 this->set_handle (ACE_INVALID_HANDLE
);
98 #if !defined (ACE_WIN32)
100 return ACE_OS::close (fd
);
102 #endif /* ACE_WIN32 */
103 return ACE_OS::t_close (fd
);
107 ACE_TLI_Stream::send (const void *buf
,
109 const ACE_Time_Value
*timeout
) const
111 ACE_TRACE ("ACE_TLI_Stream::send");
112 return ACE::send (this->get_handle (),
119 ACE_TLI_Stream::send (const void *buf
,
122 const ACE_Time_Value
*timeout
) const
124 ACE_TRACE ("ACE_TLI_Stream::send");
125 return ACE::t_snd (this->get_handle (),
133 ACE_TLI_Stream::recv (void *buf
,
135 const ACE_Time_Value
*timeout
) const
137 ACE_TRACE ("ACE_TLI_Stream::recv");
138 return ACE::recv (this->get_handle (),
145 ACE_TLI_Stream::recv (void *buf
,
148 const ACE_Time_Value
*timeout
) const
150 ACE_TRACE ("ACE_TLI_Stream::recv");
156 return ACE::t_rcv (this->get_handle (),
164 ACE_TLI_Stream::send_n (const void *buf
,
166 const ACE_Time_Value
*timeout
,
167 size_t *bytes_transferred
) const
169 ACE_TRACE ("ACE_TLI_Stream::send_n");
170 return ACE::send_n (this->get_handle (),
178 ACE_TLI_Stream::send_n (const void *buf
,
181 const ACE_Time_Value
*timeout
,
182 size_t *bytes_transferred
) const
184 ACE_TRACE ("ACE_TLI_Stream::send_n");
186 return ACE::t_snd_n (this->get_handle (),
195 ACE_TLI_Stream::recv_n (void *buf
,
197 const ACE_Time_Value
*timeout
,
198 size_t *bytes_transferred
) const
200 ACE_TRACE ("ACE_TLI_Stream::recv_n");
201 return ACE::recv_n (this->get_handle (),
209 ACE_TLI_Stream::recv_n (void *buf
,
212 const ACE_Time_Value
*timeout
,
213 size_t *bytes_transferred
) const
215 ACE_TRACE ("ACE_TLI_Stream::recv_n");
217 return ACE::t_rcv_n (this->get_handle (),
225 ACE_END_VERSIONED_NAMESPACE_DECL
227 #endif /* ACE_HAS_TLI */