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