File: UDPTransmit.3cc

package info (click to toggle)
libcommoncpp2 1.0.13-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,740 kB
  • ctags: 2,860
  • sloc: cpp: 18,857; sh: 8,451; ansic: 1,546; makefile: 299; xml: 5
file content (245 lines) | stat: -rw-r--r-- 6,872 bytes parent folder | download
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
.TH "UDPTransmit" 3 "19 Jul 2003" "CommonC++" \" -*- nroff -*-
.ad l
.nh
.SH NAME
UDPTransmit \- Representing half of a two-way UDP connection, the UDP transmitter can broadcast data to another selected peer host or to an entire subnet. Unreliable Datagram Peer Associations. 
.SH SYNOPSIS
.br
.PP
\fC#include <socket.h>\fP
.PP
Inherits \fBUDPSocket\fP.
.PP
Inherited by \fBUDPDuplex\fP.
.PP
.SS "Public Methods"

.in +1c
.ti -1c
.RI "int \fBtransmit\fP (const char *buffer, size_t len)"
.br
.RI "\fITransmit 'send' to use 'connected' send rather than sendto.\fP"
.ti -1c
.RI "bool \fBisOutputReady\fP (unsigned long timeout=0l)"
.br
.RI "\fISee if output queue is empty for sending more packets.\fP"
.ti -1c
.RI "\fBError\fP \fBsetRouting\fP (bool enable)"
.br
.ti -1c
.RI "\fBError\fP \fBsetTypeOfService\fP (\fBTos\fP tos)"
.br
.ti -1c
.RI "\fBError\fP \fBsetBroadcast\fP (bool enable)"
.br
.in -1c
.SS "Protected Methods"

.in +1c
.ti -1c
.RI "\fBUDPTransmit\fP ()"
.br
.RI "\fICreate a UDP transmitter.\fP"
.ti -1c
.RI "\fBUDPTransmit\fP (const \fBInetAddress\fP &bind, \fBtpport_t\fP port=5005)"
.br
.RI "\fICreate a UDP transmitter, bind it to a specific interface and port address so that other UDP sockets on remote machines (or the same host) may find and send UDP messages to it, and associate it with a given port on a peer host.\fP"
.ti -1c
.RI "\fBError\fP \fBconnect\fP (const \fBInetHostAddress\fP &host, \fBtpport_t\fP port)"
.br
.RI "\fIAssociate this socket with a specified peer host.\fP"
.ti -1c
.RI "\fBError\fP \fBconnect\fP (const \fBBroadcastAddress\fP &subnet, \fBtpport_t\fP port)"
.br
.RI "\fIAssociate this socket with a subnet of peer hosts for subnet broadcasting.\fP"
.ti -1c
.RI "\fBError\fP \fBconnect\fP (const \fBInetMcastAddress\fP &mgroup, \fBtpport_t\fP port)"
.br
.RI "\fIAssociate this socket with a multicast group.\fP"
.ti -1c
.RI "\fBError\fP \fBdisconnect\fP (void)"
.br
.RI "\fIDisassociate this socket from any host connection.\fP"
.ti -1c
.RI "int \fBsend\fP (const void *buf, int len)"
.br
.RI "\fITransmit 'send' to use 'connected' send rather than sendto.\fP"
.ti -1c
.RI "void \fBendTransmitter\fP (void)"
.br
.RI "\fIStop transmitter.\fP"
.ti -1c
.RI "\fBSOCKET\fP \fBgetTransmitter\fP (void)"
.br
.ti -1c
.RI "\fBError\fP \fBsetMulticast\fP (bool enable)"
.br
.ti -1c
.RI "\fBError\fP \fBsetTimeToLive\fP (unsigned char \fBttl\fP)"
.br
.in -1c
.SH "DETAILED DESCRIPTION"
.PP 
Representing half of a two-way UDP connection, the UDP transmitter can broadcast data to another selected peer host or to an entire subnet. Unreliable Datagram Peer Associations.
.PP
\fBAuthor: \fP
.in +1c
David Sugar <dyfet@ostel.com> 
.PP
.SH "CONSTRUCTOR & DESTRUCTOR DOCUMENTATION"
.PP 
.SS "UDPTransmit::UDPTransmit ()\fC [protected]\fP"
.PP
Create a UDP transmitter.
.PP
.SS "UDPTransmit::UDPTransmit (const \fBInetAddress\fP & bind, \fBtpport_t\fP port = 5005)\fC [protected]\fP"
.PP
Create a UDP transmitter, bind it to a specific interface and port address so that other UDP sockets on remote machines (or the same host) may find and send UDP messages to it, and associate it with a given port on a peer host.
.PP
On failure to bind, an exception is thrown. This class is only used to build the UDP Duplex.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIbind\fP\fP
address to bind this socket to. 
.TP
\fB\fIport\fP\fP
number to bind this socket to. 
.SH "MEMBER FUNCTION DOCUMENTATION"
.PP 
.SS "\fBError\fP UDPTransmit::connect (const \fBInetMcastAddress\fP & mgroup, \fBtpport_t\fP port)\fC [protected]\fP"
.PP
Associate this socket with a multicast group.
.PP
\fBReturns: \fP
.in +1c
0 on success, -1 on error. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fImgroup\fP\fP
address of the multicast group to send to. 
.TP
\fB\fIport\fP\fP
port number 
.SS "\fBError\fP UDPTransmit::connect (const \fBBroadcastAddress\fP & subnet, \fBtpport_t\fP port)\fC [protected]\fP"
.PP
Associate this socket with a subnet of peer hosts for subnet broadcasting.
.PP
The server must be able to assert broadcast permission for the socket.
.PP
\fBReturns: \fP
.in +1c
0 on success, -1 on error. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIsubnet\fP\fP
subnet address to broadcast into. 
.TP
\fB\fIport\fP\fP
transport port to broadcast into. 
.SS "\fBError\fP UDPTransmit::connect (const \fBInetHostAddress\fP & host, \fBtpport_t\fP port)\fC [protected]\fP"
.PP
Associate this socket with a specified peer host.
.PP
The port number from the constructor will be used. All UDP packets will be sent to and received from the specified host.
.PP
\fBReturns: \fP
.in +1c
0 on success, -1 on error. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIhost\fP\fP
address to connect socket to. 
.TP
\fB\fIport\fP\fP
to connect socket to. 
.PP
Reimplemented in \fBUDPDuplex\fP.
.SS "\fBError\fP UDPTransmit::disconnect (void)\fC [protected]\fP"
.PP
Disassociate this socket from any host connection.
.PP
No data should be read or written until a connection is established. 
.PP
Reimplemented in \fBUDPDuplex\fP.
.SS "void UDPTransmit::endTransmitter (void)\fC [inline, protected]\fP"
.PP
Stop transmitter.
.PP
.SS "\fBSOCKET\fP UDPTransmit::getTransmitter (void)\fC [inline, protected]\fP"
.PP
.SS "bool UDPTransmit::isOutputReady (unsigned long timeout = 0l)\fC [inline]\fP"
.PP
See if output queue is empty for sending more packets.
.PP
\fBReturns: \fP
.in +1c
true if output available. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fItimeout\fP\fP
in milliseconds to wait. 
.SS "int UDPTransmit::send (const void * buf, int len)\fC [inline, protected]\fP"
.PP
Transmit 'send' to use 'connected' send rather than sendto.
.PP
\fBReturns: \fP
.in +1c
number of bytes sent. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIbuf\fP\fP
address of buffer to send. 
.TP
\fB\fIlen\fP\fP
of bytes to send. 
.SS "\fBError\fP UDPTransmit::setBroadcast (bool enable)\fC [inline]\fP"
.PP
Reimplemented from \fBSocket\fP.
.SS "\fBError\fP UDPTransmit::setMulticast (bool enable)\fC [inline, protected]\fP"
.PP
Reimplemented from \fBSocket\fP.
.SS "\fBError\fP UDPTransmit::setRouting (bool enable)\fC [inline]\fP"
.PP
Reimplemented from \fBSocket\fP.
.SS "\fBError\fP UDPTransmit::setTimeToLive (unsigned char ttl)\fC [inline, protected]\fP"
.PP
Reimplemented from \fBSocket\fP.
.SS "\fBError\fP UDPTransmit::setTypeOfService (\fBTos\fP tos)\fC [inline]\fP"
.PP
Reimplemented from \fBSocket\fP.
.SS "int UDPTransmit::transmit (const char * buffer, size_t len)\fC [inline]\fP"
.PP
Transmit 'send' to use 'connected' send rather than sendto.
.PP
\fBNote: \fP
.in +1c
Windows does not support MSG_DONTWAIT, so it is defined as 0 on that platform. 
.PP
\fBReturns: \fP
.in +1c
number of bytes sent. 
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIbuffer\fP\fP
address of buffer to send. 
.TP
\fB\fIlen\fP\fP
of bytes to send. 

.SH "AUTHOR"
.PP 
Generated automatically by Doxygen for CommonC++ from the source code.