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

Method start

Skay_Exp/src/tools/nc/NetcatServer.java:34–53  ·  view source on GitHub ↗

Creates welcome socket and starts update loop to handle arbitrary sequence of clients making requests. @param port a port number @throws Exception

(int port)

Source from the content-addressed store, hash-verified

32 * @throws Exception
33 */
34 private static void start(int port) throws Exception {
35 connectionSocket = null;
36 ServerSocket serverSocket = new ServerSocket(port, 0);
37 boolean complete;
38 while (true) {
39 if (connectionSocket == null) {
40 connectionSocket = serverSocket.accept();
41 }
42 download();
43 if (System.in.available() > 0) {
44 complete = download();
45 } else {
46 complete = upload();
47 }
48 if (complete) {
49 break;
50 }
51 }
52 connectionSocket.close();
53 }
54
55 /**
56 * In download mode, server reads data from the socket and writes it to standard output.

Callers 1

uploadMethod · 0.45

Calls 2

downloadMethod · 0.95
uploadMethod · 0.95

Tested by

no test coverage detected