1
I am learning about python servers and I am using the socket library. But when I use the command socket.recv(1024)
for the server to read what the client sent, idle gives the following error:
'socket' Object has no attribute 'recv'.
What could 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)