MyPractice/udp_client.py
2026-05-06 14:56:02 +03:00

11 lines
261 B
Python

import socket
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
message = b'hello server'
client.sendto(message, ('127.0.0.1', 15000))
data, server_addr = client.recvfrom(1024)
print(f"Ответ от сервера: {data.decode()}")
client.close()