I'm learning about servers in python and I'm using the socket library. But when I use the socket.recv(1024)
command for the server to read what the client sent, IDLE gives the following error:
'socket' object has no attribute 'recv'.
What could it be?
The code:
import socket
cliente = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = "localhost"
porta = 5000
confirma = cliente.connect((host, porta))
if (confirma) == -1:
print("ACESSO NEGADO")
else:
print("ACESSO PERMITIDO")
while True:
pergunta = cliente.recv(1024)
print(pergunta)