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"
8 #if defined (ACE_HAS_TLI)
10 #if !defined (__ACE_INLINE__)
11 #include "ace/TLI_Stream.inl"
12 #endif /* __ACE_INLINE__ */
14 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
16 ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Stream
)
19 ACE_TLI_Stream::dump () const
21 #if defined (ACE_HAS_DUMP)
22 ACE_TRACE ("ACE_TLI_Stream::dump");
23 #endif /* ACE_HAS_DUMP */
26 ACE_TLI_Stream::ACE_TLI_Stream ()
29 ACE_TRACE ("ACE_TLI_Stream::ACE_TLI_Stream");
33 ACE_TLI_Stream::get_remote_addr (ACE_Addr
&sa
) const
35 ACE_TRACE ("ACE_TLI_Stream::get_remote_addr");
38 name
.maxlen
= sa
.get_size ();
39 name
.buf
= (char *) sa
.get_addr ();
41 if (ACE_OS::t_getname (this->get_handle (), &name
, REMOTENAME
) == -1)
47 // Send a release and then await the release from the other side.
50 ACE_TLI_Stream::active_close ()
52 ACE_TRACE ("ACE_TLI_Stream::active_close");
55 if (this->sndrel () == -1)
57 else if (this->recv (&buf
, sizeof buf
) == -1)
59 if (t_errno
== TLOOK
&& this->look () == T_ORDREL
)
61 if (this->rcvrel () == -1)
68 return this->close ();
71 // Acknowledge the release from the other side and then send the
72 // release to the other side.
75 ACE_TLI_Stream::passive_close ()
77 ACE_TRACE ("ACE_TLI_Stream::passive_close");
79 if (this->rcvrel () == -1)
81 else if (this->sndrel () == -1)
84 return this->close ();
88 ACE_TLI_Stream::close ()
90 ACE_TRACE ("ACE_TLI_Stream::close");
92 ACE_HANDLE fd
= this->get_handle ();
94 this->set_handle (ACE_INVALID_HANDLE
);
96 #if !defined (ACE_WIN32)
98 return ACE_OS::close (fd
);
100 #endif /* ACE_WIN32 */
101 return ACE_OS::t_close (fd
);
105 ACE_TLI_Stream::send (const void *buf
,
107 const ACE_Time_Value
*timeout
) const
109 ACE_TRACE ("ACE_TLI_Stream::send");
110 return ACE::send (this->get_handle (),
117 ACE_TLI_Stream::send (const void *buf
,
120 const ACE_Time_Value
*timeout
) const
122 ACE_TRACE ("ACE_TLI_Stream::send");
123 return ACE::t_snd (this->get_handle (),
131 ACE_TLI_Stream::recv (void *buf
,
133 const ACE_Time_Value
*timeout
) const
135 ACE_TRACE ("ACE_TLI_Stream::recv");
136 return ACE::recv (this->get_handle (),
143 ACE_TLI_Stream::recv (void *buf
,
146 const ACE_Time_Value
*timeout
) const
148 ACE_TRACE ("ACE_TLI_Stream::recv");
154 return ACE::t_rcv (this->get_handle (),
162 ACE_TLI_Stream::send_n (const void *buf
,
164 const ACE_Time_Value
*timeout
,
165 size_t *bytes_transferred
) const
167 ACE_TRACE ("ACE_TLI_Stream::send_n");
168 return ACE::send_n (this->get_handle (),
176 ACE_TLI_Stream::send_n (const void *buf
,
179 const ACE_Time_Value
*timeout
,
180 size_t *bytes_transferred
) const
182 ACE_TRACE ("ACE_TLI_Stream::send_n");
184 return ACE::t_snd_n (this->get_handle (),
193 ACE_TLI_Stream::recv_n (void *buf
,
195 const ACE_Time_Value
*timeout
,
196 size_t *bytes_transferred
) const
198 ACE_TRACE ("ACE_TLI_Stream::recv_n");
199 return ACE::recv_n (this->get_handle (),
207 ACE_TLI_Stream::recv_n (void *buf
,
210 const ACE_Time_Value
*timeout
,
211 size_t *bytes_transferred
) const
213 ACE_TRACE ("ACE_TLI_Stream::recv_n");
215 return ACE::t_rcv_n (this->get_handle (),
223 ACE_END_VERSIONED_NAMESPACE_DECL
225 #endif /* ACE_HAS_TLI */