practice2_Shv/udp_client.py
2026-04-12 21:52:52 +03:00

14 lines
312 B
Python

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