Maintenance break on 26.1. (Wed) at 12:00.

Commit ab3349a8 authored by Matti Pulkkinen's avatar Matti Pulkkinen
Browse files

added flush to writeInt in StreamHandler

parent ff6e0b18
......@@ -11,6 +11,7 @@ public class Main {
int t = 0;
try {
t = sh.readInt();
System.err.println("Received t = " + t);
} catch (IOException e) {
System.err.println("Failed in reading t through ObjectInputStream.");
e.printStackTrace();
......@@ -23,10 +24,16 @@ public class Main {
} catch (IOException e) {
System.out.println("Failed in sending response for illegal value.");
e.printStackTrace();
System.exit(2);
}
System.err.println("Response sent, terminating...");
System.exit(2);
}
for (int i = 0; i < t; i++) {
int r = (int) (Math.random() * 5000 + 1024); // TODO ensure no duplicates
sh.writeInt(r);
}
}
}
......@@ -25,6 +25,6 @@ public class StreamHandler {
void writeInt(int n) throws IOException {
this.oos.writeInt(n);
this.oos.flush();
} // writeInt(int)
} // class StreamHandler
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment