In upload mode, client reads data from its standard input device and writes it to the socket. @throws Exception
(int port)
| 64 | * @throws Exception |
| 65 | */ |
| 66 | @SuppressWarnings("Duplicates") |
| 67 | private static void upload(int port) throws Exception { |
| 68 | Scanner input = new Scanner(System.in); |
| 69 | while (input.hasNextLine()) { |
| 70 | byte[] sendData = input.nextLine().getBytes(); |
| 71 | clientSocket.send(new DatagramPacket(sendData, sendData.length, ipAddress, port)); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Starts execution of the program, requiring a host name and port number as an argument. |