2zadaniepraktiki/client_udp.py
2026-04-16 23:02:46 +03:00

14 lines
337 B
Python

import socket
HOST = "127.0.0.1"
PORT = 12346
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
message = input("Введите сообщение: ")
client.sendto(message.encode("utf-8"), (HOST, PORT))
response, addr = client.recvfrom(1024)
print("Ответ от сервера:", response.decode("utf-8"))
client.close()