Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
468ed350
Commit
468ed350
authored
3 years ago
by
justi
Browse files
Options
Downloads
Patches
Plain Diff
Frank Assignment 2
parent
c62a684e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankClient.java
+13
-3
13 additions, 3 deletions
...0Cohort2021JulySeptember/homework2/Frank/FrankClient.java
with
13 additions
and
3 deletions
assignments/src/MV3500Cohort2021JulySeptember/homework2/Frank/FrankClient.java
+
13
−
3
View file @
468ed350
...
@@ -4,6 +4,8 @@ import java.io.BufferedReader;
...
@@ -4,6 +4,8 @@ import java.io.BufferedReader;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.PrintStream
;
import
java.io.Reader
;
import
java.io.Reader
;
import
java.net.Socket
;
import
java.net.Socket
;
...
@@ -37,6 +39,9 @@ public class FrankClient {
...
@@ -37,6 +39,9 @@ public class FrankClient {
BufferedReader
br
;
BufferedReader
br
;
String
serverMessage
;
String
serverMessage
;
int
clientLoopCount
=
0
;
int
clientLoopCount
=
0
;
OutputStream
os
;
PrintStream
ps
;
try
{
try
{
while
(
true
)
{
while
(
true
)
{
...
@@ -64,13 +69,18 @@ public class FrankClient {
...
@@ -64,13 +69,18 @@ public class FrankClient {
System
.
out
.
print
(
clientLoopCount
+
": "
);
System
.
out
.
print
(
clientLoopCount
+
": "
);
System
.
out
.
println
(
"Hola!"
);
System
.
out
.
println
(
"Hola!"
);
System
.
out
.
println
(
"The message the server sent was: '"
+
serverMessage
+
"'"
);
System
.
out
.
println
(
"The message the server sent was: '"
+
serverMessage
+
"'"
);
int
count
=
0
;
System
.
out
.
println
(
"test"
);
count
++;
// socket gets closed, either automatically/silently by this code (or possibly by the server)
// socket gets closed, either automatically/silently by this code (or possibly by the server)
if
(
serverMessage
.
equals
(
"this is good bye message from Franks server"
))
{
//if client recieved termanation message stop client
if
(
serverMessage
.
equals
(
"this is good bye message from Franks server"
))
{
//if client recieved termanation message stop client
break
;
break
;
}
}
os
=
socket
.
getOutputStream
();
ps
=
new
PrintStream
(
os
);
ps
.
println
(
"I'm doing well!"
);
// this gets sent back to server
ps
.
flush
();
Thread
.
sleep
(
1000
);
// turned it down to 1 second
Thread
.
sleep
(
1000
);
// turned it down to 1 second
}
// end while(true) // infinite loops are dangerous, be sure to kill this process!
}
// end while(true) // infinite loops are dangerous, be sure to kill this process!
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment