Use BufferedReader for input from client.
Determine open port dynamically.