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

Method download

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

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

(int port)

Source from the content-addressed store, hash-verified

46 * @throws Exception
47 */
48 private static void download(int port) throws Exception {
49 if (!pinged) {
50 byte[] sendData = "".getBytes();
51 DatagramPacket pingPacket = new DatagramPacket(sendData, sendData.length, ipAddress, port);
52 clientSocket.send(pingPacket);
53 pinged = true;
54 }
55 byte[] receiveData = new byte[4096];
56 DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
57 clientSocket.receive(receivePacket);
58 System.out.println(new String(receivePacket.getData()).trim());
59 }
60
61 /**
62 * In upload mode, client 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