OSC (Open Sound Control) プロトコルを介して、 chuckと pythonの間の通信をセットアップしようとしています。Python 側ではpython-osc ライブラリを使用しており、chuck は OSC プロトコルをネイティブにサポートしています。Python側から送信したメッセージがchuck側に届かないようです。ただし、他のすべての組み合わせ、つまり python から python、chuck からchuck、chuck から python は問題なく動作します。Windows 7 で python 3.4.4 を実行しています。
テストに使用しているクライアント/サーバー実装の 4 つのファイルを次に示します。
チャック_クライアント.py:
OscSend xmit;
xmit.setHost("localhost", 5005);
<<<"Sending">>>;
xmit.startMsg("/debug");
チャック_サーバー.py:
OscRecv orec;
5005 => orec.port;
orec.listen();
orec.event("/debug") @=> OscEvent e;
<<<"Waiting">>>;
e => now;
<<<"Received">>>;
python_client.py:
from pythonosc import osc_message_builder
from pythonosc import udp_client
client = udp_client.UDPClient('localhost', 5005)
msg = osc_message_builder.OscMessageBuilder(address="/debug")
msg = msg.build()
print('Sending')
client.send(msg)
python_server.py:
from pythonosc import dispatcher
from pythonosc import osc_server
dispatcher = dispatcher.Dispatcher()
dispatcher.map("/debug", lambda _: print('Received'))
print('Waiting')
server = osc_server.ThreadingOSCUDPServer(
('localhost', 5005), dispatcher)
print("Serving on {}".format(server.server_address))
server.serve_forever()