File: UDPDuplex.html

package info (click to toggle)
libape 1.0.0-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,572 kB
  • ctags: 1,343
  • sloc: sh: 7,342; cpp: 3,418; makefile: 117
file content (169 lines) | stat: -rw-r--r-- 5,865 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
<HTML><HEAD><TITLE>UDPDuplex Class</TITLE></HEAD>
<BODY bgcolor="#ffffff">

<H1>UDPDuplex Class Reference</H1>
<p>
[<A HREF="index.html">APE Index</A>] [<A HREF="hier.html">APE Hierarchy</A>]
[<A HREF="header-list.html">Headers</A>]
</p>
<HR>
<P>Unreliable Datagram Peer Associations.   <a href="#short">More...</a></P>
<P>
<code>
	#include &lt;<a href="socket-h.html">socket.h</a>&gt;
</code>

</P>

<H2>Public Members</H2>
<UL>
<LI> <b><a href="#ref0">UDPDuplex</a></b> (InetAddress &amp;bind, short from, short to) 
</LI>
<LI> <b><a href="#ref1">~UDPDuplex</a></b> () 
</LI>
<LI>int <b><a href="#ref2">Connect</a></b> (InetHostAddress &amp;host) 
</LI>
<LI>int <b><a href="#ref3">Broadcast</a></b> (BroadcastAddress &amp;subnet) 
</LI>
<LI>int <b><a href="#ref4">Disconnect</a></b> (void) 
</LI>
<LI>int <b><a href="#ref5">Loopback</a></b> (void) 
</LI>
<LI>int <b><a href="#ref6">Peek</a></b> (void *addr, size_t len) 
</LI>
<LI>int <b><a href="#ref7">Read</a></b> (void *addr, size_t len) 
</LI>
<LI>int <b><a href="#ref8">Write</a></b> (void *addr, size_t len) 
</LI>
</UL>
<HR>
<H2><a name="short">Detailed Description</a></H2>
<P>

 UDP duplex connections impliment a bi-directional point-to-point UDP
 session between two peer hosts.  Two UDP sockets are typically used
 on alternating port addresses to assure that sender and receiver
 data does not collide or echo back.  A UDP Duplex is commonly used
 for full duplex real-time streaming of UDP data between hosts.
 

</P><HR>
<H3><b> <a name="ref0"></a><a name="UDPDuplex">UDPDuplex</a>(<a href="InetAddress.html">InetAddress</a> &amp;bind, short from, short to)  </b><code>[public]</code></H3>
<p>Create a UDP duplex as a pair of UDP simplex objects
bound to alternating and interconnected port addresses.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
port</td><td align="left" valign="top">
number to bind reciever.</td></tr>
<tr><td align="left" valign="top">
bind</td><td align="left" valign="top">
address to bind this socket to.</td></tr>
</table>
</dl>
<H3><b> <a name="ref1"></a><a name="~UDPDuplex">~UDPDuplex</a>()  </b><code>[public]</code></H3>
<p>Disconnect and remove a UDP Duplex session.
</p>
<H3><b>int <a name="ref2"></a><a name="Connect">Connect</a>(<a href="InetHostAddress.html">InetHostAddress</a> &amp;host)  </b><code>[public]</code></H3>
<p>Associate the duplex with a specified peer host. Both
the sender and receiver will be interconnected with
the remote host.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
host</td><td align="left" valign="top">
address to connect socket to.</td></tr>
</table>
</dl>
<dl><dt><b>Returns</b>:<dd>
0 on success, -1 on error.</dl>
<H3><b>int <a name="ref3"></a><a name="Broadcast">Broadcast</a>(<a href="BroadcastAddress.html">BroadcastAddress</a> &amp;subnet)  </b><code>[public]</code></H3>
<p>Associate transmitter and receiver with a subnet
for multi-peer subnet media streaming.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
subnet</td><td align="left" valign="top">
address to operate under.</td></tr>
</table>
</dl>
<dl><dt><b>Returns</b>:<dd>
0 on success, -1 on error.</dl>
<H3><b>int <a name="ref4"></a><a name="Disconnect">Disconnect</a>(void)  </b><code>[public]</code></H3>
<p>Disassociate this duplex from any host connection.  No data
should be read or written until a connection is established.
</p>
<H3><b>int <a name="ref5"></a><a name="Loopback">Loopback</a>(void)  </b><code>[public]</code></H3>
<p>Associate the duplex with itself only.  This can be used as
a "disconnect" on systems which do not define AF_UNSPEC.  This
also means any data sent by the socket will be received by
itself.
</p>
<H3><b>int <a name="ref6"></a><a name="Peek">Peek</a>(void *addr, size_t len)  </b><code>[public]</code></H3>
<p>Examine next waiting UDP packet in the buffer without actually
removing it from the socket head.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
length</td><td align="left" valign="top">
of packet to accept.</td></tr>
<tr><td align="left" valign="top">
address</td><td align="left" valign="top">
to store packet to examine.</td></tr>
</table>
</dl>
<dl><dt><b>Returns</b>:<dd>
number of bytes available.</dl>
<H3><b>int <a name="ref7"></a><a name="Read">Read</a>(void *addr, size_t len)  </b><code>[public]</code></H3>
<p>Read (receive) a UDP packet from the remote host using the
simpex receiver.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
maximum</td><td align="left" valign="top">
length of packet to accept.</td></tr>
<tr><td align="left" valign="top">
address</td><td align="left" valign="top">
to store packet received.</td></tr>
</table>
</dl>
<dl><dt><b>Returns</b>:<dd>
number of bytes read, or -1 on error.</dl>
<H3><b>int <a name="ref8"></a><a name="Write">Write</a>(void *addr, size_t len)  </b><code>[public]</code></H3>
<p>Write (send) a UDP packet to the remote host using the
simplex sender.
</p><p>
</p>
<dl><dt><b>Parameters</b>:<dd>
<table width="100%" border="0">
<tr><td align="left" valign="top">
length</td><td align="left" valign="top">
of packet to send.</td></tr>
<tr><td align="left" valign="top">
address</td><td align="left" valign="top">
of packet to send.</td></tr>
</table>
</dl>
<dl><dt><b>Returns</b>:<dd>
number of bytes sent, or -1 on error.</dl>
<HR>
<TABLE WIDTH="100%"><TR><TD ALIGN="left" VALIGN="top">

<UL><LI><I>Author</I>: David Sugar &lt;dyfet@ostel.com&gt;. </LI>
<LI>Documentation generated by dyfet@home.sys on Thu Dec 16 09:54:26 EST 1999
</LI>
</UL></TD><TD ALIGN="RIGHT" VALIGN="TOP">
<b>K</b><i>doc</i>
</TD>
</TR></TABLE></BODY></HTML>