Pd LAN Party
------------

Copyright Chris McCormick, 2009.

This is a fork of [PodSixNet](http://mccormick.cx/dev/PodSixNet/)

This is a client-server system for associating Pd patches (Or RjDj scenes) with
eachother on the local area network, or wifi network automatically. Start the
server lanparty.py and then put the object [lanparty] into your patch. Any
message into the [lanparty] object will be replicated to all other connected
patches on the network at the outlet of their [lanparty] object. See the help
file for an example use.

License
-------

Licensed under the terms of the LGPL v3.0 or higher.
See the file [COPYING](COPYING) for details.

Advanced use
------------

If you want to make more complicated servers than a simple echo of all messages
to all [lanparty] objects, you can use the PdLANParty class in your own code
as follows.

Set up a new PdLANServer object:

 p = PdLANParty() # create the server
 p.Launch() # launch the server off in a separate thread

Use the PdLANServer object to communicate with all patches. Something like this
should go in your main-loop:

 p.PostMessage(['drum', '5', 'bang'])	# send a message to all connected patches
 p.GetMesssages() # get an array of arrays containing messages from clients

Here is an example of what kind of data will be sent and received:

Pd Client connects
Server receives: ['connected', '1']
Pd Client receives: server ip 192.168.2.113;
Pd Client receives: server id 1;
Server sends: ['drum', '5', 'bang']
Pd Client receives: drum 5 bang;
Pd Client sends: this is my test;
Server receives: ['this', 'is', 'my', 'test']

Here's what the default main-loop in lanparty.py looks like. It is an echo
server, and sends all messages it receives from any client, back to all clients
(one-to-many messaging).

 p = PdLANParty()
 p.Launch()
 try:
     while 1:
         [p.PostMessage(m) for m in p.GetMessages()]
         sleep(0.001)
 except KeyboardInterrupt:
     exit(0)

