rob@76
|
1 OSCgroups client and server
|
rob@76
|
2 (c) Ross Bencina 2005-2013 <rossb@audiomulch.com>
|
rob@76
|
3
|
rob@76
|
4
|
rob@76
|
5 OSCgroups is a system for routing OSC messages between a group of
|
rob@76
|
6 collaborating users. It is designed to make joining and leaving a
|
rob@76
|
7 group simple, and to overcome the problem of connecting multiple
|
rob@76
|
8 users behind different NAT routers using a NAT traversal server with
|
rob@76
|
9 the usual "NAT hole punching" scheme (you can put that into google
|
rob@76
|
10 for more info). OSCgroups also implements basic group functionality
|
rob@76
|
11 similar to the concept of channels in internet relay chat.
|
rob@76
|
12
|
rob@76
|
13 To use OSCgroups, a group of collaborators (or processes) each pick a
|
rob@76
|
14 unique user name and password, and all agree on a shared group name
|
rob@76
|
15 and group password. They then each run an OSCgroups enabled client
|
rob@76
|
16 which connects with a server to retrieve the names, ip addresses and
|
rob@76
|
17 port numbers of all other group members. This information can easily
|
rob@76
|
18 be refreshed over time allowing dynamic group membership, this also
|
rob@76
|
19 supports situations where ip addresses may change. Once an
|
rob@76
|
20 OSCgroups client has the list of user names, addresses and port
|
rob@76
|
21 numbers it could do a number of things, for example it could
|
rob@76
|
22 implement message forwarding to named endpoints (i.e. always send
|
rob@76
|
23 these messages to user 'fred' no matter what his address is) or to
|
rob@76
|
24 multicast messages to all other members of the group.
|
rob@76
|
25
|
rob@76
|
26 In this initial release of OSCgroups there is only one client:
|
rob@76
|
27 OscGroupClient -- which implements multicast to other group members.
|
rob@76
|
28 Future versions may include more advanced point-to-point routing
|
rob@76
|
29 functionality.
|
rob@76
|
30
|
rob@76
|
31 This distribution contains OSCGroupServer and OSCGroupClient, both
|
rob@76
|
32 written in C++. It is envisiaged that OSCgroups clients could also be
|
rob@76
|
33 implemented in other environments such as SuperCollider or max.msp.
|
rob@76
|
34
|
rob@76
|
35
|
rob@76
|
36
|
rob@76
|
37 COMPILING
|
rob@76
|
38 ---------
|
rob@76
|
39
|
rob@76
|
40 OSCgroups is implemented using oscpack, a simple C++ library for
|
rob@76
|
41 packing and unpacking OSC messages. In general you should try
|
rob@76
|
42 to build OSCgroups with a similarly timestamped snapshot of
|
rob@76
|
43 oscpack.
|
rob@76
|
44
|
rob@76
|
45 To compile oscgroups, unzip the oscgroups and oscpack archives
|
rob@76
|
46 (or check out from the svn repository) to obtain the following
|
rob@76
|
47 directory structure:
|
rob@76
|
48
|
rob@76
|
49
|
rob@76
|
50 /oscgroups
|
rob@76
|
51 Makefile
|
rob@76
|
52 ... (other files from the oscgroups zip)
|
rob@76
|
53 /bin
|
rob@76
|
54
|
rob@76
|
55 /oscpack
|
rob@76
|
56 /osc
|
rob@76
|
57 /ip
|
rob@76
|
58 ....
|
rob@76
|
59
|
rob@76
|
60
|
rob@76
|
61 On Unix just type
|
rob@76
|
62
|
rob@76
|
63 >make
|
rob@76
|
64
|
rob@76
|
65 in the oscgroups directory and the OscGroupServer and OscGroupClient
|
rob@76
|
66 should end up in the bin directory. If you encounter any compilation
|
rob@76
|
67 errors please email me. For other platforms take a look at the
|
rob@76
|
68 makefile and work out which source files you need to build and which
|
rob@76
|
69 include directories need to be on your include path.
|
rob@76
|
70
|
rob@76
|
71 There is a batch file for building with MinGW on Windows (make.MinGW32.bat)
|
rob@76
|
72
|
rob@76
|
73 There is a CMakeLists.txt file that you can use with CMake.
|
rob@76
|
74
|
rob@76
|
75 OSCgroups should compile everywhere oscpack compiles, which is at
|
rob@76
|
76 least Windows, Linux and MacOSX.
|
rob@76
|
77
|
rob@76
|
78
|
rob@76
|
79
|
rob@76
|
80 RUNNING
|
rob@76
|
81 -------
|
rob@76
|
82
|
rob@76
|
83 * OSCGroupsServer
|
rob@76
|
84
|
rob@76
|
85
|
rob@76
|
86 To run your own OSCGroupsServer simply run the OSCGroupsServer,
|
rob@76
|
87 use -h to get a list of possible parameters. You can specify
|
rob@76
|
88 the port the server listens on, limit the number of connected
|
rob@76
|
89 users and groups, set a timeout after which the server will
|
rob@76
|
90 forget inactive users, and specify a file to which log messages
|
rob@76
|
91 will be written. Without any parameters the server will run
|
rob@76
|
92 on the default port 22242
|
rob@76
|
93
|
rob@76
|
94
|
rob@76
|
95 * OscGroupClient
|
rob@76
|
96
|
rob@76
|
97 This client registers with the server and establishes contact with
|
rob@76
|
98 all the other members of the specified group. It then listens on a
|
rob@76
|
99 specified port and transfers all traffic from there to other group
|
rob@76
|
100 members. It also forwards all traffic from other group members to
|
rob@76
|
101 another specified port on the local machine. The arguments are as
|
rob@76
|
102 follows (you can get a summary of this info by just passing -h). Note
|
rob@76
|
103 that all arguments must be supplied, and given in the order listed
|
rob@76
|
104 below.
|
rob@76
|
105
|
rob@76
|
106 servername
|
rob@76
|
107 an internet name such as oscgroups.iua.upf.edu or an ip address
|
rob@76
|
108 such as 193.145.55.19
|
rob@76
|
109
|
rob@76
|
110 serverport
|
rob@76
|
111 the udp port which the server is listening on, the server
|
rob@76
|
112 defaults to 22242
|
rob@76
|
113
|
rob@76
|
114 localtoremoteport
|
rob@76
|
115 the local port used to connect with the server and to other
|
rob@76
|
116 group members.
|
rob@76
|
117
|
rob@76
|
118 localtxport
|
rob@76
|
119 this is the port which OscGroupClient listens to and forwards
|
rob@76
|
120 to other group members. direct your OSC traffic to this port.
|
rob@76
|
121
|
rob@76
|
122 localrxport
|
rob@76
|
123 this is the port which OscGroupClient forwards trafic from
|
rob@76
|
124 other users to. you should configure your OSC application to listen
|
rob@76
|
125 to this port.
|
rob@76
|
126
|
rob@76
|
127 username
|
rob@76
|
128 a unique user name used to identify you with other clients.
|
rob@76
|
129
|
rob@76
|
130 password
|
rob@76
|
131 a password which is used to try to make sure that no one else
|
rob@76
|
132 pretends to be you on the server. this isn't secure but it helps.
|
rob@76
|
133
|
rob@76
|
134 groupname
|
rob@76
|
135 a name that all group members agree on, like a user name it
|
rob@76
|
136 should be unique.
|
rob@76
|
137
|
rob@76
|
138 grouppassword
|
rob@76
|
139 a password for the group. users without the correct password
|
rob@76
|
140 won't be admitted to the group.
|
rob@76
|
141
|
rob@76
|
142
|
rob@76
|
143 All of the port numbers specified need to be different. If multiple
|
rob@76
|
144 users are behind the same NAT and you experience difficulties. you
|
rob@76
|
145 might like to try all using a different value for localtoremoteport
|
rob@76
|
146 for each user, although this shouldn't usually be necessary.
|
rob@76
|
147
|
rob@76
|
148 OSCGroups will report if you failed to register with the server
|
rob@76
|
149 because of an incorrect password. This could be caused by another user
|
rob@76
|
150 with the same name being connected to the server. So try to pick
|
rob@76
|
151 your usernames to be unique, or use your own server. Like IRC, the
|
rob@76
|
152 server forgets names quickly if no client is using them.
|
rob@76
|
153
|
rob@76
|
154
|
rob@76
|
155 Here's an example:
|
rob@76
|
156
|
rob@76
|
157
|
rob@76
|
158 ./OscGroupClient oscgroups.iua.upf.edu 22242 22243 22244 22245 tim
|
rob@76
|
159 timspassword testgroup testpass
|
rob@76
|
160
|
rob@76
|
161
|
rob@76
|
162 with the above running in one window you could run oscdump:
|
rob@76
|
163
|
rob@76
|
164 OscDump localhost 22245
|
rob@76
|
165
|
rob@76
|
166 then all messages sent by all other group members (but not you) would
|
rob@76
|
167 be dumped to the console.
|
rob@76
|
168
|
rob@76
|
169 If you're lucky there is an OSCGroupsServer running on oscgroups.iua.upf.edu
|
rob@76
|
170 port 22242
|
rob@76
|
171
|
rob@76
|
172
|
rob@76
|
173 If you want to run OscGroupClient on the same machine as the server
|
rob@76
|
174 make sure that you use a real ip address or machine name (not
|
rob@76
|
175 localhost or 127.0.0.1) as the servername parameter of OscGroupClient
|
rob@76
|
176 otherwise it won't work properly. This is a kind of bug which I don't
|
rob@76
|
177 really want to fix right now.
|
rob@76
|
178
|
rob@76
|
179
|
rob@76
|
180 If you have a software firewall installed on your machine you may need
|
rob@76
|
181 to ensure that the OscGroupClient executable is registered with the
|
rob@76
|
182 firewall. If you update the executable you may need to re-register it.
|
rob@76
|
183 Also remember that the local-to-remote port (22242) must not be blocked
|
rob@76
|
184 by your firewall.
|
rob@76
|
185
|
rob@76
|
186
|
rob@76
|
187
|
rob@76
|
188 PLANNED EXTENSIONS
|
rob@76
|
189 ------------------
|
rob@76
|
190
|
rob@76
|
191 The planned extensions can be summarised as:
|
rob@76
|
192
|
rob@76
|
193 - serverless operation for locally connected machines using IP broadcast
|
rob@76
|
194
|
rob@76
|
195 - compute and display ping times
|
rob@76
|
196
|
rob@76
|
197 - point-to-point routing in OscGroupClient
|
rob@76
|
198
|
rob@76
|
199
|
rob@76
|
200
|
rob@76
|
201 NOTES
|
rob@76
|
202 -----
|
rob@76
|
203
|
rob@76
|
204 This is an initial version and it's possible that a few things will
|
rob@76
|
205 change, including the protocol. Right now it isn't foolproof, the
|
rob@76
|
206 references below suggest it probably works behind about 80-85% of
|
rob@76
|
207 routers on the market today -- this is a little worrying in the
|
rob@76
|
208 context of using it to perform live, however the alternatives involve
|
rob@76
|
209 providing fallback strategies such as forwarding via a server using
|
rob@76
|
210 TCP on port 80 -- perhaps that can be added for version 2. There is a
|
rob@76
|
211 nice analysis of the Skype protocol in the references section. There
|
rob@76
|
212 are clearly many things which could be added to OSCGroups, but for
|
rob@76
|
213 now the idea is to keep it simple.
|
rob@76
|
214
|
rob@76
|
215 I mentioned above that OSCGroups clients could be implemented with
|
rob@76
|
216 other OSC enabled applications. While this is true in theory, I'm not
|
rob@76
|
217 sure how practical it would be because the NAT traversal strategy
|
rob@76
|
218 requires that the same socket be used for sending and receiving data
|
rob@76
|
219 to the outside world. The OscGroupClient uses a fixed port number for
|
rob@76
|
220 this, but that isn't strictly required.
|
rob@76
|
221
|
rob@76
|
222 The server protocol has been designed to be pretty general, and
|
rob@76
|
223 OscGroupClient doesn't really take full advantage of it. For example,
|
rob@76
|
224 it would be easy to implement point-to-point routing (send these
|
rob@76
|
225 messages only to these users), or to fire events when users join or
|
rob@76
|
226 leave a group.
|
rob@76
|
227
|
rob@76
|
228 Right now OscGroupClient parses every OSC packet it sees: this isn't
|
rob@76
|
229 ideal but it also isn't easy to avoid. One method might be to use
|
rob@76
|
230 non-bundled messages for /groupclient/ping messages so that it can
|
rob@76
|
231 only process non-bundled packets. Another option is to take advantage
|
rob@76
|
232 of the fact that every message is parsed and allow the packets to
|
rob@76
|
233 pass routing information. In reality the routing information would be
|
rob@76
|
234 easier to use if it was embedded in outbound packets (eg send this
|
rob@76
|
235 packet to this username). It's not obvious to me how to cleanly
|
rob@76
|
236 provide an interface to this functionality (or if it is really
|
rob@76
|
237 needed) so it hasn't been done.
|
rob@76
|
238
|
rob@76
|
239
|
rob@76
|
240
|
rob@76
|
241 SOME REFERENCES
|
rob@76
|
242 ---------------
|
rob@76
|
243
|
rob@76
|
244 NAT and Peer-to-peer networking
|
rob@76
|
245 Dan Kegel
|
rob@76
|
246 http://alumnus.caltech.edu/~dank/peer-nat.html
|
rob@76
|
247
|
rob@76
|
248 Peer-to-Peer Communication Across Network Address Translators
|
rob@76
|
249 Bryan Ford, Pyda Srisuresh, Dan Kegel
|
rob@76
|
250 http://www.brynosaurus.com/pub/net/p2pnat/
|
rob@76
|
251
|
rob@76
|
252 RFC3489: STUN - Simple Traversal of User Datagram Protocol (UDP)
|
rob@76
|
253 Through Network Address Translators (NATs)
|
rob@76
|
254 http://www.ietf.org/rfc/rfc3489.txt
|
rob@76
|
255
|
rob@76
|
256 An Analysis of Skype Peer-to-Peer Internet Telephony Protocol
|
rob@76
|
257 Salman A. Baset and Henning Schulzrinne
|
rob@76
|
258 http://arxiv.org/ftp/cs/papers/0412/0412017.pdf
|
rob@76
|
259
|
rob@76
|
260 Beej's Guide to Network Programming
|
rob@76
|
261 http://www.ecst.csuchico.edu/~beej/guide/net/
|
rob@76
|
262
|
rob@76
|
263
|
rob@76
|
264 Thanks to John Lazzaro for hooking me up with the right information.
|
rob@76
|
265
|
rob@76
|
266
|
rob@76
|
267
|
rob@76
|
268
|