16 lines
484 B
Python
16 lines
484 B
Python
|
|
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')
|