I'm having the following error whenever I try to send a message from the server to the client using sockets in Python:
importsockets=socket.socket(socket.AF_INET,socket.SOCK_STREAM)host='localhost'port=5008s.bind((host,port))s.listen(1)conn,addr=s.accept()whileTrue:data=conn.recv(1024).decode()print(data)msg=input("mensagem:")
s.send(bytes(msg.encode()))
client:
import socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host = 'localhost'
port = 5008
s.connect((host, port))
while True:
msg = input("mensagem:")
s.send(msg.encode())
data = s.recv(1024).decode()
print(data)