pi@raspberrypi ~/pyOSC $ ./OSC.py Welcome to the OSC testing program. byte 0 1 2 3 4 5 6 7 8 9 A B C D E F 000 : 57 65 6C 63 6F 6D 65 20 74 6F 20 74 68 65 20 4F : 'Welcome to the O' 010 : 53 43 20 74 65 73 74 69 6E 67 20 70 72 6F 67 72 : 'SC testing progr' 020 : 61 6D 2E : 'am.' /print [44, 11, 4.5, 'the white cliffs of dover'] byte 0 1 2 3 4 5 6 7 8 9 A B C D E F 000 : 2F 70 72 69 6E 74 00 00 2C 69 69 66 73 00 00 00 : '/print\x00\x00,iifs\x00\x00\x00' 010 : 00 00 00 2C 00 00 00 0B 40 90 00 00 74 68 65 20 : '\x00\x00\x00,\x00\x00\x00\x0b@\x90\x00\x00the ' 020 : 77 68 69 74 65 20 63 6C 69 66 66 73 20 6F 66 20 : 'white cliffs of ' 030 : 64 6F 76 65 72 00 00 00 : 'dover\x00\x00\x00' Making and unmaking a message.. /prin{ce,t} ['Mary had a little lamb', 'its fleece was white as snow', 'and everywhere that Mary went,', 'the lamb was sure to go.', 14.5, 14.5, -400] byte 0 1 2 3 4 5 6 7 8 9 A B C D E F 000 : 2F 70 72 69 6E 7B 63 65 2C 74 7D 00 2C 73 73 73 : '/prin{ce,t}\x00,sss' 010 : 73 66 66 69 00 00 00 00 4D 61 72 79 20 68 61 64 : 'sffi\x00\x00\x00\x00Mary had' 020 : 20 61 20 6C 69 74 74 6C 65 20 6C 61 6D 62 00 00 : ' a little lamb\x00\x00' 030 : 69 74 73 20 66 6C 65 65 63 65 20 77 61 73 20 77 : 'its fleece was w' 040 : 68 69 74 65 20 61 73 20 73 6E 6F 77 00 00 00 00 : 'hite as snow\x00\x00\x00\x00' 050 : 61 6E 64 20 65 76 65 72 79 77 68 65 72 65 20 74 : 'and everywhere t' 060 : 68 61 74 20 4D 61 72 79 20 77 65 6E 74 2C 00 00 : 'hat Mary went,\x00\x00' 070 : 74 68 65 20 6C 61 6D 62 20 77 61 73 20 73 75 72 : 'the lamb was sur' 080 : 65 20 74 6F 20 67 6F 2E 00 00 00 00 41 68 00 00 : 'e to go.\x00\x00\x00\x00Ah\x00\x00' 090 : 41 68 00 00 FF FF FE 70 : 'Ah\x00\x00\xff\xff\xfep' Retrieving arguments... /prin{ce,t} ,ssssffi Mary had a little lamb its fleece was white as snow and everywhere that Mary went, the lamb was sure to go. 14.5 14.5 -400 ['/prin{ce,t}', ',ssssffi', 'Mary had a little lamb', 'its fleece was white as snow', 'and everywhere that Mary went,', 'the lamb was sure to go.', 14.5, 14.5, -400] Testing Blob types. /pri* ['', 'b\x00\x00\x00', 'bl\x00\x00', 'blo\x00', 'blob', 'blobs\x00\x00\x00', 42] byte 0 1 2 3 4 5 6 7 8 9 A B C D E F 000 : 2F 70 72 69 2A 00 00 00 2C 62 62 62 62 62 62 69 : '/pri*\x00\x00\x00,bbbbbbi' 010 : 00 00 00 00 00 00 00 00 00 00 00 04 62 00 00 00 : '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04b\x00\x00\x00' 020 : 00 00 00 04 62 6C 00 00 00 00 00 04 62 6C 6F 00 : '\x00\x00\x00\x04bl\x00\x00\x00\x00\x00\x04blo\x00' 030 : 00 00 00 04 62 6C 6F 62 00 00 00 08 62 6C 6F 62 : '\x00\x00\x00\x04blob\x00\x00\x00\x08blob' 040 : 73 00 00 00 00 00 00 2A : 's\x00\x00\x00\x00\x00\x00*' Testing OSCBundle #bundle [/print ["Hey man, that's cool.", 42, 3.141592502593994], /print ['bundled messages:', 2], /*print ['no,', 3, 'actually.']] byte 0 1 2 3 4 5 6 7 8 9 A B C D E F 000 : 23 62 75 6E 64 6C 65 00 00 00 00 00 00 00 00 01 : '#bundle\x00\x00\x00\x00\x00\x00\x00\x00\x01' 010 : 00 00 00 30 2F 70 72 69 6E 74 00 00 2C 73 69 66 : '\x00\x00\x000/print\x00\x00,sif' 020 : 00 00 00 00 48 65 79 20 6D 61 6E 2C 20 74 68 61 : '\x00\x00\x00\x00Hey man, tha' 030 : 74 27 73 20 63 6F 6F 6C 2E 00 00 00 00 00 00 2A : "t's cool.\x00\x00\x00\x00\x00\x00*" 040 : 40 49 0F DA 00 00 00 24 2F 70 72 69 6E 74 00 00 : '@I\x0f\xda\x00\x00\x00$/print\x00\x00' 050 : 2C 73 69 00 62 75 6E 64 6C 65 64 20 6D 65 73 73 : ',si\x00bundled mess' 060 : 61 67 65 73 3A 00 00 00 00 00 00 02 00 00 00 24 : 'ages:\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00$' 070 : 2F 2A 70 72 69 6E 74 00 2C 73 69 73 00 00 00 00 : '/*print\x00,sis\x00\x00\x00\x00' 080 : 6E 6F 2C 00 00 00 00 03 61 63 74 75 61 6C 6C 79 : 'no,\x00\x00\x00\x00\x03actually' 090 : 2E 00 00 00 : '.\x00\x00\x00' Instantiating OSCClient: OSCClient v0.3.5b-5294 connected to osc://localhost:2222 Instantiating OSCServer: OSCServer v0.3.5b-5294 listening on osc://localhost:2222 Registered Callback-functions: /printed /print default /info /error /serverinfo Starting OSCServer. Use ctrl-C to quit. Requesting OSC-address-space and subscribed clients from OSCServer sending: /info ['info'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['server', 'OSCServer v0.3.5b-5294 listening on osc://localhost:2222'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['info_command', 'ls | list : list OSC address-space'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['info_command', 'clients | targets : list subscribed clients'] sending: /info ['list'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['address', '/printed'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['address', '/print'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['address', 'default'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['address', '/info'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['address', '/error'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['address', '/serverinfo'] sending: /info ['clients'] OSCServer: OSCMessage '/serverinfo' from localhost:2222: ['target', 'osc://localhost:2222/'] Sending Messages sending: /print [44, 11, 4.5, 'the white cliffs of dover'] OSCServer Got: '/print [iifs] [44, 11, 4.5, 'the white cliffs of dover']' from localhost:2222 OSCServer: OSCMessage '/printed' from localhost:2222: ["/print [iifs] [44, 11, 4.5, 'the white cliffs of dover']"] sending: /print ["Hey man, that's cool.", 42, 3.141592502593994] OSCServer Got: '/print [sif] ["Hey man, that's cool.", 42, 3.141592502593994]' from localhost:2222 OSCServer: OSCMessage '/printed' from localhost:2222: ['/print [sif] ["Hey man, that\'s cool.", 42, 3.141592502593994]'] sending: /noprint ["Hey man, that's cool.", 42, 3.141592502593994] OSCServer: No callback registered to handle OSC-address '/noprint' OSCServer: OSCMessage '/error' from localhost:2222: ["No callback registered to handle OSC-address '/noprint'"] sending: /prin{ce,t} ['Mary had a little lamb', 'its fleece was white as snow', 'and everywhere that Mary went,', 'the lamb was sure to go.', 14.5, 14.5, -400] OSCServer Got: '/prin{ce,t} [ssssffi] ['Mary had a little lamb', 'its fleece was white as snow', 'and everywhere that Mary went,', 'the lamb was sure to go.', 14.5, 14.5, -400]' from localhost:2222 OSCServer: OSCMessage '/printed' from localhost:2222: ["/prin{ce,t} [ssssffi] ['Mary had a little lamb', 'its fleece was white as snow', 'and everywhere that Mary went,', 'the lamb was sure to go.', 14.5, 14.5, -400]"] sending: #bundle [/print ["Hey man, that's cool.", 42, 3.141592502593994], /print ['bundled messages:', 2], /*print ['no,', 3, 'actually.']] OSCServer Got: '/print [sif] ["Hey man, that's cool.", 42, 3.141592502593994]' from localhost:2222 OSCServer Got: '/print [si] ['bundled messages:', 2]' from localhost:2222 OSCServer Got: '/*print [sis] ['no,', 3, 'actually.']' from localhost:2222 OSCServer: OSCMessage '/printed' from localhost:2222: ['/print [sif] ["Hey man, that\'s cool.", 42, 3.141592502593994]'] OSCServer: OSCMessage '/printed' from localhost:2222: ["/print [si] ['bundled messages:', 2]"] OSCServer: OSCMessage '/printed' from localhost:2222: ["/*print [sis] ['no,', 3, 'actually.']"] The next message's address will match both the '/print' and '/printed' handlers... sending: /pri* ['', 'b\x00\x00\x00', 'bl\x00\x00', 'blo\x00', 'blob', 'blobs\x00\x00\x00', 42] OSCServer: OSCMessage '/pri*' from localhost:2222: ['', 'b\x00\x00\x00', 'bl\x00\x00', 'blo\x00', 'blob', 'blobs\x00\x00\x00', 42] OSCServer Got: '/pri* [bbbbbbi] ['', 'b\x00\x00\x00', 'bl\x00\x00', 'blo\x00', 'blob', 'blobs\x00\x00\x00', 42]' from localhost:2222 OSCServer: OSCMessage '/printed' from localhost:2222: ["/pri* [bbbbbbi] ['', 'b\\x00\\x00\\x00', 'bl\\x00\\x00', 'blo\\x00', 'blob', 'blobs\\x00\\x00\\x00', 42]"] Bundles can be given a timestamp. The receiving server should 'hold' the bundle until its time has come Set timetag 5 s into the future sending: #bundle (17:22:14.464) [/print ['Note how the (single-thread) OSCServer blocks while holding this bundle']] Recursing bundles, with timetags set to 10 s [25 s, 20 s, 10 s] sending: #bundle (17:22:19.572) [#bundle (17:22:34.573) [/print ['held for 25 sec']], #bundle (17:22:29.574) [/print ['held for 20 sec']], #bundle (17:22:24.575) [/print ['held for 15 sec']], /print ["Note how the (single-thread) OSCServer handles the bundle's contents in order of appearance"]] Messages sent! Waiting for OSCServer. Use ctrl-C to quit. OSCServer Got: '/print [s] ['Note how the (single-thread) OSCServer blocks while holding this bundle']' from localhost:2222 ^C Closing OSCServer. Waiting for Server-thread to finish OSCServer Got: '/print [s] ['held for 25 sec']' from localhost:2222 OSCServer Got: '/print [s] ['held for 20 sec']' from localhost:2222 OSCServer Got: '/print [s] ['held for 15 sec']' from localhost:2222 OSCServer Got: '/print [s] ["Note how the (single-thread) OSCServer handles the bundle's contents in order of appearance"]' from localhost:2222 OSCServer: error on request from localhost:2222: (9, 'Bad file descriptor') Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 505, in run self.__target(*self.__args, **self.__kwargs) File "./OSC.py", line 1816, in serve_forever self.handle_request() # this times-out when no data arrives. File "/usr/lib/python2.7/SocketServer.py", line 280, in handle_request self._handle_request_noblock() File "/usr/lib/python2.7/SocketServer.py", line 297, in _handle_request_noblock self.handle_error(request, client_address) File "./OSC.py", line 2022, in handle_error self.sendOSCerror("%s: %s" % (e_type.__name__, str(e)), client_address) File "./OSC.py", line 1972, in sendOSCerror self.client.sendto(msg, client_address) File "./OSC.py", line 1096, in sendto ret = select.select([],[self._fd], [], timeout) error: (9, 'Bad file descriptor') Closing OSCClient Done pi@raspberrypi ~/pyOSC $