I’m writing code on Pythone. The essence of the code is to create a server socket on one computer and turn it on, and on the second send a request with a message to the first computer and have it written in the terminal. But he gives me an error:Backtracking (last call):
sock.connect((‘127.234.231.124’, 55894))
Connection change error: [WinError 10061] Disconnection has not been established, because the permanent computer is disconnected when turned on
here is the code for the server socket itself:
`
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.234.231.124', 55894))
sock.listen()
print('Подключено')
while True:
conn, addr = sock.accept()
print(addr)
data = conn.recv(1024)
conn.send(data.upper())
conn.close()
`
and here is the code for the client socket:
`
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('127.234.231.124', 55894))
sock.send(bytes('Hello, world', encoding = 'UTF-8'))
data = sock.recv(1024)
sock.close()
print(data)
`
I tried to change the operating system, change the host
New contributor