-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for now only with Curio, but trio and pure asyncio planned
- Loading branch information
Showing
7 changed files
with
326 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from curio import socket | ||
|
||
import curio | ||
|
||
from oscpy.server import OSCCurioServer | ||
|
||
|
||
async def osc_app(address, port): | ||
osc = OSCCurioServer(encoding='utf8') | ||
osc.listen(address=address, port=port, default=True) | ||
|
||
@osc.address("/example") | ||
async def example(*values): | ||
print(f"got {values} on /example") | ||
await curio.sleep(4) | ||
print("done sleeping") | ||
|
||
@osc.address("/test") | ||
async def test(*values): | ||
print(f"got {values} on /test") | ||
await curio.sleep(4) | ||
print("done sleeping") | ||
|
||
@osc.address("/stop") | ||
async def stop(*values): | ||
print(f"time to leave!") | ||
await osc.stop() | ||
|
||
await osc.process() | ||
|
||
curio.run(osc_app, '0.0.0.0', 8000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from oscpy.server import OSCThreadServer | ||
from time import sleep | ||
|
||
osc = OSCThreadServer() | ||
sock = osc.listen(address='0.0.0.0', port=8000, default=True) | ||
|
||
@osc.address(b'/address') | ||
def callback(*values): | ||
print("got values: {}".format(values)) | ||
|
||
sleep(1000) | ||
osc.stop() |
Oops, something went wrong.