# Outline of a proxy server # Make a socket and listen (like a server) # When a client connects: # Connect to the server they're actually wanting to talk to # Start Thread 1 with start_new_thread # Start doing the loop for Thread 2 # The pattern: # Read from client # Send what you read from the client to the server # Read from the server # Sent what you read from the server to the client # Solution to getting stuck # Thread 1: # Infinite loop: # Read from client # If that read didn't work, break out of the loop # Send what you read from the client to the server # # Thread 2: # Infinite loop: # Read from server # If that read didn't work, break out of the loop # Send what you read from the server to the client