Skip to content

OSCServer

OSCServer

A threaded OSC server using python-osc library. With a given message handler function, will call that function on incoming messages.

__init__(ip='0.0.0.0', port=5005, osc_msg_handler=None)

Initialize the OSC server with IP, port, and message handler.

Parameters:

Name Type Description Default
ip str

IP address to bind the server to. If "0.0.0.0", listens on all interfaces. This is the default.

'0.0.0.0'
port int

Port number to listen on.

5005
osc_msg_handler function

Function to handle incoming OSC messages.

None

set_osc_msg_handler(handler)

Set a custom OSC message handler.

Parameters:

Name Type Description Default
handler function

Function to handle incoming OSC messages.

required

start()

Start the OSC server in a separate thread

stop()

Stop the OSC server gracefully