First commit - interlock python script
This commit is contained in:
commit
d777cf6f61
21
interlock/Interlock_socket_script.py
Normal file
21
interlock/Interlock_socket_script.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import socket
|
||||||
|
import time
|
||||||
|
|
||||||
|
ip = "0.0.0.0" # Listen to all channels
|
||||||
|
port = 5005 # Should match .ino
|
||||||
|
|
||||||
|
time.sleep (5)
|
||||||
|
|
||||||
|
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
|
s.bind((ip, port))
|
||||||
|
s.listen()
|
||||||
|
print(f"Listening")
|
||||||
|
|
||||||
|
while True:
|
||||||
|
conn, addr = s.accept()
|
||||||
|
with conn:
|
||||||
|
data = conn.recv(1024)
|
||||||
|
if data:
|
||||||
|
print(f"Received from {addr}: {data.decode().strip()}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user