Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Teemu Auvinen
DTEK1066-ryhmis
Commits
ab3349a8
Commit
ab3349a8
authored
Dec 03, 2017
by
Matti Pulkkinen
Browse files
added flush to writeInt in StreamHandler
parent
ff6e0b18
Changes
2
Hide whitespace changes
Inline
Side-by-side
DTEK1066-ryhmis/src/fi/utu/dtek1066/Main.java
View file @
ab3349a8
...
...
@@ -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
);
}
}
}
DTEK1066-ryhmis/src/fi/utu/dtek1066/StreamHandler.java
View file @
ab3349a8
...
...
@@ -25,6 +25,6 @@ public class StreamHandler {
void
writeInt
(
int
n
)
throws
IOException
{
this
.
oos
.
writeInt
(
n
);
this
.
oos
.
flush
();
}
// writeInt(int)
}
// class StreamHandler
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment