Comments (1)
OSCUdpServer
inherits from socketserver.UDPServer
, which also has a method handle_request
.
This handles a single request, so you need to call it multiple times on each tick. It respects a timeout if one is set, which you can do with server.timeout = 1
(where you replace 1 with your timeout in seconds. Set to 0 to have it try once and immediately return).
To notice that you ran into a timeout, you need to override the handle_timeout
method of the server object, which is called when handle_request
times out.
Alternatively you could use the asyncio UDPServer (I think that's python 3.6+ only):
import pythonosc.dispatcher
import pythonosc.osc_server
import asyncio
oscdispatcher = pythonosc.dispatcher.Dispatcher()
oscserverloop = asyncio.get_event_loop()
oscserver = pythonosc.osc_server.AsyncIOOSCUDPServer((oscserveraddress, oscserverport), oscdispatcher, oscserverloop)
oscserver.serve()
And then run the event loop ONCE with
oscserverloop.stop()
oscserverloop.run_forever()
That way it will handle all current requests once and then return to your program.
from python-osc.
Related Issues (20)
- Retrieving OSC argument from Threading Server and sending it to a Client HOT 1
- Facing OSError: [Errno 48] Address already in use HOT 1
- Running with root possible? HOT 3
- Problems with ThreadingOSCUDPServer [receiving in Ubuntu terminal] HOT 1
- ValueError: Infered arg_value type is not supported
- OSC server can't receive broadcast message HOT 3
- Access to client ip and port in callback HOT 2
- how can I put the received message to GUI? HOT 1
- Need help HOT 2
- pythonosc Cannot be resolved!
- use add_arg within a for loop HOT 1
- Publish type annotations? HOT 1
- can't send Chinese HOT 4
- cann't close osc server/py script
- An easier way to send and receive from the same port ? HOT 1
- How to create an OSC server without blocking GUI operations
- How to display data in GUI tkinter label ? HOT 1
- how make an osc response from the server HOT 3
- How to set a timeout value?
- SimpleUDPClient.send_message -> Type of parameter "value" is partially unknown
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-osc.