4
I am having the following error whenever I try to send a message from the server to the client using Python sockets:
import socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host = 'localhost'
port = 5008
s.bind((host,port))
s.listen(1)
conn,addr = s.accept()
while True:
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)
Post the code directly here, editing the question.
– user28595
As requested I made Edit in the post including the code
– Nathan Aguiar Neves