I am writing a program that allows computers within a wifi network to connect to it, after a certain period of time it should no longer accept connections and be ready to send a message to all connected clients
I have tried a while loop but I can't find a way to time limit it
here is my current code: import socket
connections = []
s = socket.socket()
host = socket.gethostname()
port = 8080
s.bind((host, port))
s.listen(1)
print(".....")
while True:
conn, addr = s.accept()
connections.append([conn, addr])
connections[-1][0].send("welcome".encode())
#after a certain amount of time I want that loop to stop and wait for a
command to be typed or some other input method