import socket HOST = '129.159.146.88' PORT = 5000 #message = "Если посмотреть на небо, можно увидеть как улетает башня от Т-72" #message = "Тестовый бот WarOnline - доложить о работоспособности систем!" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket: client_socket.connect((HOST, PORT)) client_socket.sendall(message.encode()) print('Wait...') data = client_socket.recv(1024) try: received_string = data.decode('utf-8') print(f'Received string from server: {received_string}') except: #sometimes there is a problem with the decoding print('decoding error, please try again')