15 lines
344 B
Python
15 lines
344 B
Python
import socket
|
|
|
|
HOST = "127.0.0.1"
|
|
PORT = 12345
|
|
|
|
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
client.connect((HOST, PORT))
|
|
|
|
message = input("Введите сообщение: ")
|
|
client.sendall(message.encode("utf-8"))
|
|
|
|
response = client.recv(1024)
|
|
print("Ответ от сервера:", response.decode("utf-8"))
|
|
|
|
client.close() |