18 lines
444 B
Python
18 lines
444 B
Python
|
|
#!/usr/bin/env python
|
||
|
|
"""Simple OSC receiver for testing."""
|
||
|
|
|
||
|
|
import socket
|
||
|
|
from pythonosc.osc_message import OscMessage
|
||
|
|
|
||
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||
|
|
sock.bind(("0.0.0.0", 54001))
|
||
|
|
print("Listening on port 54001...")
|
||
|
|
|
||
|
|
while True:
|
||
|
|
data, addr = sock.recvfrom(4096)
|
||
|
|
msg = OscMessage(dgram=data)
|
||
|
|
print(f"From {addr}: {msg.address}", end="")
|
||
|
|
for p in msg.params:
|
||
|
|
print(f" {p}", end="")
|
||
|
|
print()
|