Skip to content

Navigation Menu

Sign in
Sign up

Bundled messages are ignored by dispatcher #190

Open

Description

I am writing a listen server for the VMC Protocol, which is an OSC protocol that includes bundled messages.
https://protocol.vmc.info/english.html

I wrote a barebones server

from pythonosc.dispatcher import Dispatcher
from pythonosc import osc_server
if __name__ == "__main__":
 dispatcher = Dispatcher()
 dispatcher.set_default_handler(print)
 server = osc_server.ThreadingOSCUDPServer(("0.0.0.0", 39539), dispatcher)
 print(f"Serving on {server.server_address}")
 server.serve_forever()

However, the output is the same unbundled message repeating, with the bundled messages not getting printed.

...
/VMC/Ext/Blend/Apply
/VMC/Ext/Blend/Apply
/VMC/Ext/Blend/Apply
...

If I use this other script to simply listen directly to the socket, then I can see all of the bundled messages

import socket
from pythonosc.osc_bundle import OscBundle
from pythonosc.osc_message import OscMessage
UDP_IP, UDP_PORT = "0.0.0.0", 39539
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
print(f"Listening on {UDP_IP}:{UDP_PORT}")
while True:
 data, _ = sock.recvfrom(65535)
 print(data)
 print()

Output:

...
b'/VMC/Ext/Blend/Apply\x00\x00\x00\x00,\x00\x00\x00'
b'#bundle\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00D/VMC/Ext/Bone/Pos\x00\x00\x00,sfffffff\x00\x00\x00Hips\x00\x00\x00\x00\xbc\xa21\xf8?\x90\xdb\xb5\xbb\xdbl:\xb8\xda\x17k\xbb\xf9a\x91:\xe5\xf8#?\x7f\xfe\x01\x00\x00\x00D/VMC/Ext/Root/Pos\x00\x00\x00,sfffffff\x00\x00\x00root\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb7\x15)+\xbaGH\x8496\x99\xb1?\x7f\xff\xfb\x00\x00\x00L/VMC/Ext/Bone/Pos\x00\x00\x00,sfffffff\x00\x00\x00LeftUpperLeg\x00\x00\x00\x00\xbd\xe3\x187\xbd$_\x00\xb20\x00\x00\xbd\xae3\xf0\xbe@\x0cy<\xca\xbd\xde?zn\xc4\x00\x00\x00L/VMC/Ext/Bone/...
...

I feel like I am doing something wrong here, and I shouldn't have to bypass the Dispatcher to get bundled messages.
How can I do this without using Socket? Am I doing someething wrong here, or does dispatcher just ignore bundled messages?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /