In upload mode, server reads data from its standard input device and writes it to the socket. @throws Exception
()
| 65 | * @throws Exception |
| 66 | */ |
| 67 | private static void upload() throws Exception { |
| 68 | byte[] receiveData = new byte[4096]; |
| 69 | DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); |
| 70 | serverSocket.receive(receivePacket); |
| 71 | System.out.println(new String(receivePacket.getData()).trim()); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Starts execution of the program, requiring a port number as an argument. |