MCPcopy Create free account
hub / github.com/0linlin0/CyberBox / download

Method download

Skay_Exp/src/tools/nc/NetcatUDPServer.java:48–60  ·  view source on GitHub ↗

In download mode, server reads data from the socket and writes it to standard output. @throws Exception

()

Source from the content-addressed store, hash-verified

46 * @throws Exception
47 */
48 private static void download() throws Exception {
49 if (!pinged) {
50 byte[] receiveData = new byte[1024];
51 pingPacket = new DatagramPacket(receiveData, receiveData.length);
52 serverSocket.receive(pingPacket);
53 pinged = true;
54 }
55 Scanner input = new Scanner(System.in);
56 while (input.hasNextLine()) {
57 byte[] sendData = input.nextLine().getBytes();
58 serverSocket.send(new DatagramPacket(sendData, sendData.length, pingPacket.getAddress(), pingPacket.getPort()));
59 }
60 }
61
62 /**
63 * In upload mode, server reads data from its standard input device and writes it to the socket.

Callers 1

startMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected