commit 9bb4f025d45f3401772a87654b33e8d885ef8947
parent d9e20e4ca572389a30983016176554a16c044d08
Author: Daniel Barlow <dan@telent.net>
Date: Sat, 10 Jan 2026 22:15:40 +0000
send udp packet
Diffstat:
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/shore.py b/shore.py
@@ -3,8 +3,12 @@
import termuxgui as tg
import time
import sys
+import socket
+
peer_hostname = None
+peer_socket = None
+
started = False
hosts = {
@@ -55,11 +59,21 @@ with tg.Connection() as c:
def start_recording(start_or_stop):
global started
+ global peer_socket
if start_or_stop and peer_hostname != None:
+ started = True
print("pretending to do udp things")
+ peer_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ peer_socket.connect((peer_hostname, 5000))
+ interval = 500
+ b = bytes([interval >> 8, interval & 0xff, 0x54, 0x11, 0, 25] )
+ peer_socket.send(b)
else:
print("pretending to close udp socket")
- started = start_or_stop
+ if peer_socket != None:
+ peer_socket.close()
+ peer_socket = None
+ started = False
instances = tg.LinearLayout(a)