1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/* -*- C++ -*- */
// $Id$
// TLI_Stream.i
#include "ace/TLI_Stream.h"
inline ssize_t
ACE_TLI_Stream::send (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_TLI_Stream::send");
return ACE_OS::write (this->get_handle (), (const char *) buf, n);
}
inline ssize_t
ACE_TLI_Stream::send (const void *buf, size_t n, int flags) const
{
ACE_TRACE ("ACE_TLI_Stream::send");
return ACE_OS::t_snd (this->get_handle (), (char *) buf, n, flags);
}
inline ssize_t
ACE_TLI_Stream::recv (void *buf, size_t n) const
{
ACE_TRACE ("ACE_TLI_Stream::recv");
return ACE_OS::read (this->get_handle (), (char *) buf, n);
}
inline ssize_t
ACE_TLI_Stream::recv (void *buf, size_t n, int *flags) const
{
ACE_TRACE ("ACE_TLI_Stream::recv");
int f = 0;
if (flags == 0)
flags = &f;
return ACE_OS::t_rcv (this->get_handle (), (char *) buf, n, flags);
}
inline ssize_t
ACE_TLI_Stream::send_n (const void *buf, size_t n) const
{
ACE_TRACE ("ACE_TLI_Stream::send_n");
return ACE::send_n (this->get_handle (), buf, n);
}
inline ssize_t
ACE_TLI_Stream::send_n (const void *buf, size_t n, int flags) const
{
ACE_TRACE ("ACE_TLI_Stream::send_n");
size_t b_sent;
ssize_t b_written = 0;
for (b_sent = 0; b_sent < n; b_sent += b_written)
if ((b_written = ACE_OS::t_snd (this->get_handle (),
(char *) buf + b_sent,
n - b_sent, flags)) == -1)
return -1;
return b_sent;
}
inline ssize_t
ACE_TLI_Stream::recv_n (void *buf, size_t n) const
{
ACE_TRACE ("ACE_TLI_Stream::recv_n");
return ACE::recv_n (this->get_handle (), buf, n);
}
inline ssize_t
ACE_TLI_Stream::recv_n (void *buf, size_t n, int *flags) const
{
ACE_TRACE ("ACE_TLI_Stream::recv_n");
size_t b_read = 0;
ssize_t b_recv = 0;
int f = 0;
if (flags == 0)
flags = &f;
for (b_read = 0; b_read < n; b_read += b_recv)
if ((b_recv = ACE_OS::t_rcv (this->get_handle (),
(char *) buf + b_read,
n - b_read, flags)) == -1)
return -1;
else if (b_recv == 0)
break;
return b_read;
}
inline void
ACE_TLI_Stream::set_rwflag (int value)
{
ACE_TRACE ("ACE_TLI_Stream::set_rwflag");
this->rwflag_ = value;
}
inline int
ACE_TLI_Stream::get_rwflag (void)
{
ACE_TRACE ("ACE_TLI_Stream::get_rwflag");
return this->rwflag_;
}
|