15 lines
286 B
Python
15 lines
286 B
Python
import socket
|
|
|
|
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
message = b'hello server'
|
|
server_address = ('127.0.0.1', 10001)
|
|
|
|
|
|
client.sendto(message, server_address)
|
|
|
|
|
|
data, _ = client.recvfrom(1024)
|
|
print(f"Ответ от сервера: {data.decode()}")
|
|
|
|
client.close()
|