aboutsummaryrefslogtreecommitdiffstats
path: root/tests/sockets/send.py
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2021-12-04 17:05:29 +0100
committerNao Pross <np@0hm.ch>2021-12-04 17:05:29 +0100
commit9d0910c5140b28a84017b9bbb4def22d15425518 (patch)
tree26836d9005a93afabbb71edd6fddbc194e601a5f /tests/sockets/send.py
parentUpdate documentation (diff)
parentUpdate net.py to decode UDP data stream (diff)
downloadFading-9d0910c5140b28a84017b9bbb4def22d15425518.tar.gz
Fading-9d0910c5140b28a84017b9bbb4def22d15425518.zip
Merge branch 'master' of github.com:NaoPross/Fading
Diffstat (limited to 'tests/sockets/send.py')
-rw-r--r--tests/sockets/send.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/sockets/send.py b/tests/sockets/send.py
new file mode 100644
index 0000000..87faf5d
--- /dev/null
+++ b/tests/sockets/send.py
@@ -0,0 +1,21 @@
+import socket
+from urllib.parse import urlparse
+
+import numpy as np
+
+remote = "upd://localhost:31415"
+url = urlparse(remote)
+
+print(url.hostname)
+print(url.port)
+
+sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+sock.connect((url.hostname, url.port))
+
+# sent some text
+sock.send(bytes("hello", "ascii"))
+
+arr = np.arange(0, 10)
+print(arr)
+
+sock.send(arr.tobytes())