Creates client socket makes request to the server. @throws Exception
(String host, int port)
| 25 | * @throws Exception |
| 26 | */ |
| 27 | private static void start(String host, int port) throws Exception { |
| 28 | if (clientSocket == null) { |
| 29 | clientSocket = new Socket(host, port); |
| 30 | } |
| 31 | if (System.in.available() > 0) { |
| 32 | upload(); |
| 33 | } else { |
| 34 | download(); |
| 35 | } |
| 36 | clientSocket.close(); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * In download mode, client reads data from the socket and writes it to standard output. |