Вот мой server.py:
Код: Выделить всё
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((socket.gethostname(), 7908))
s.listen(5)
while True:
clientsocket, address = s.accept()
print(f"Connection from {address} established")
clientsocket.send(bytes("Test", "utf-8"))
Код: Выделить всё
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("my_public_ip_address", 7908))
print(s.recv(8).decode("utf-8"))
Спасибо, что нашли время прочитать и ответить на этот вопрос
Подробнее здесь: https://stackoverflow.com/questions/611 ... on-sockets
Мобильная версия