flandre/test/legacy/testrobotremotecontrol.py

16 lines
484 B
Python
Raw Normal View History

2025-03-23 22:33:55 +08:00
import socket
def send_message(message: str, host='11.6.1.53', port=29999):
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((host, port))
try:
client_socket.sendall(message.encode())
print(f"Sent: {message}")
finally:
client_socket.close()
if __name__ == "__main__":
# send_message('remoteControl -on\nplay\nremoteControl -off\n')
send_message('remoteControl -on\nstop\nremoteControl -off\n')