@@ -0,0 +1,1094 @@
+%22%22%22%0A%0AA simple chat server using TCP/IP and the publisher-subscriber pattern.%0A%0A@author Steven Briggs%0A@version 2015.05.25%0A%0A%22%22%22%0A%0Aimport sys%0Aimport argparse%0Aimport socket%0A%0ADEFAULT_PORT = 8080%0ADEFAULT_BACKLOG = 5%0A%0Adef get_args():%0A    %22%22%22%0A%0A    Parse and return the arguments given at the command line%0A%0A    @returns the command line arguments%0A%0A    %22%22%22%0A    parser = argparse.ArgumentParser()%0A    parser.add_argument(%22-p%22, %22--port%22, default=DEFAULT_PORT, type=int, help=%22port number for the server%22)%0A    return parser.parse_args()%0A%0Adef main():%0A    args = get_args()%0A    port = args.port%0A%0A    # Prepare the listening socket%0A    server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)%0A    server_socket.bind((socket.gethostname(), port))%0A    server_socket.listen(DEFAULT_BACKLOG)%0A%0A    # Accept connections until the program is killed%0A    running = True%0A    while running:%0A        (client_socket, address) = server_socket.accept()%0A        client_socket.close()%0A        print(%22Got a client @ address %7B0%7D%22.format(address))%0A%0A    server_socket.close()%0A%0Aif __name__ == %22__main__%22:%0A    sys.exit(main())

Add a simple accept loop for clients