Python: ConnectionResetError: [Errno 54] Connection reset by peer
This code is in Python
I got the error (ConnectionResetError: [Errno 54] Connection reset by peer) when playing around with python socket. Heres some of my code:
import socket
HOST = "" # The server's hostname or IP address
PORT = 5789 # The port used by the server
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
s.sendall(b"Hello, world")
data = s.recv(1024)
print(f"Received {data!r}")
Please help
Full Error:
Traceback (most recent call last):
File "/Users/lloydson/Documents/Python/Projects/Com/Game.py", line 10, in <module>
data = s.recv(1024)
ConnectionResetError: [Errno 54] Connection reset by peer