Help With Python Sockets

import socket, threading

HOST = '0.0.0.0'
PORT = 8080

ServerSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ServerSocket.bind((HOST, PORT))
ServerSocket.listen()

CurrentConnections = []

print(f"Server listening on {HOST}:{PORT}...")

def ReceiveClient(Connection):
    while True:
        RawData = Connection.recv(1024)
        Data = RawData.decode("utf-8")
        
        print(f"Echoing {Data}")
        
        for OConnection in CurrentConnections:
            OConnection.send(RawData)

while True:
    Connection, Address = ServerSocket.accept()
    
    if Connection in CurrentConnections:
        continue
    
    print(f"Got new connection for {Address}")
    
    CurrentConnections.append(Connection)
    threading.Thread(target=ReceiveClient, args=(Connection,)).start()

this code above works perfectly for my local machine. But when I try running it in render it spams “Echoing”, then errors. Anyone know how to fix this?

Update, I made it so that it can work. But now for some reason it just gets alot of requests spammed to it???

I see that you’ve already initiated a support ticket with us. To avoid any confusion or duplicate efforts, let’s continue the conversation there

Jérémy.
Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.