14 lines
312 B
Python
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() |