Created
August 28, 2012 18:55
-
-
Save buhii/3502327 to your computer and use it in GitHub Desktop.
txosc practice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _callback(result): | |
print("connected") | |
client.send(osc.Message('/ack')) | |
from twisted.internet import reactor | |
from txosc import osc, dispatch, async | |
client = async.ClientFactory() | |
_client_port = reactor.connectTCP('10.0.1.2', 59603, client) | |
client.deferred.addCallback(_callback) | |
reactor.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo_handler(message, address): | |
print map(lambda v: v.value, message.arguments) | |
print "Got %s from %s" % (message, address) | |
from twisted.internet import reactor | |
from txosc import osc, dispatch, async | |
receiver = dispatch.Receiver() | |
receiver.addCallback("/move", foo_handler) | |
_server_port = reactor.listenTCP(59603, async.ServerFactory(receiver)) | |
reactor.run() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment