When doing a network broadcast from Python, I get this: OSError: [Errno 101] Network is unreachable
My code is as follows:
def send(ip, message): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip, 4601)) try: sock.sendall(message) response = sock.recv(1024) finally: sock.close() if response: return response else: return False
I replaced ip with "<broadcast>" and that's when I get the error. My server is listening on port 4601 so I don't understand what's going on. I also replaced it with the actual network broadcast address provided in network-manager and still got nothing.