Corrected, I should start by saying that variables with special characters (ç, ã ...) are not at all advised, and with capital letters in the first letter is also not conventional.
You were also doing two cycles while True:
without any break
in the first one, we all know what this results in, when in fact it is only in the second (second) that you need to be "eternally" thing you can do is use context manager to "open the sockets" this way in addition to being currently the most advised, also need to close the sockets, as well as its use in opening a file:
from socket import*
host = "localhost"
port = 9003
with socket(AF_INET, SOCK_STREAM) as sockobj:
sockobj.bind((host, port))
sockobj.listen(5)
conexao, endereco = sockobj.accept() # esperar ate que cliente se ligue
print('Server conectado por', endereco)
while True:
data = conexao.recv(1024)
if not data:break
Note that when I was testing one of the errors you gave me:
ConnectionRefusedError: [Errno 111] Connection refused
This because of the port
that was being used by any other process