30 lines
571 B
Python
30 lines
571 B
Python
import socket
|
|
import asyncio
|
|
import time
|
|
|
|
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
addr=input("type Ip: ")
|
|
if not addr:
|
|
addr="127.0.0.1"
|
|
|
|
try:
|
|
client_socket.connect((addr,1201))
|
|
except Exception:
|
|
print("не подключается")
|
|
time.sleep(5)
|
|
exit
|
|
|
|
client_socket.sendall(b'\x03\x04\x08\x08')
|
|
print(f"отправил, жду")
|
|
try:
|
|
data = client_socket.recv(1024)
|
|
print(data)
|
|
print(data.decode())
|
|
print(f"дождался")
|
|
except Exception:
|
|
print("отвал")
|
|
client_socket.close()
|
|
time.sleep(5)
|
|
|
|
|