Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kms1920
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Louis Fahrenholz
kms1920
Commits
3e91f1dd
Commit
3e91f1dd
authored
5 years ago
by
Stefan Rosenlund
Browse files
Options
Downloads
Patches
Plain Diff
Added success byte
parent
13aea610
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kms_exercise/client_server/Server.java
+6
-2
6 additions, 2 deletions
kms_exercise/client_server/Server.java
with
6 additions
and
2 deletions
kms_exercise/client_server/Server.java
+
6
−
2
View file @
3e91f1dd
...
...
@@ -145,19 +145,23 @@ public class Server {
OutputStream
stream
=
client
.
getOutputStream
();
byte
[]
result
=
new
byte
[
0
];
byte
[]
success
=
{
0
};
if
(
read
.
equals
(
"LIST"
))
{
result
=
this
.
list
().
getBytes
();
success
[
0
]
=
1
;
}
else
if
(
read
.
matches
(
"^GET .+"
))
{
String
path
=
read
.
substring
(
4
);
result
=
this
.
getFileContent
(
path
);
success
[
0
]
=
1
;
}
else
{
String
message
=
"Not supported command!"
;
result
=
message
.
getBytes
();
}
short
length
=
(
short
)
result
.
length
;
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
length
+
2
);
short
length
=
(
short
)
(
result
.
length
+
1
)
;
ByteBuffer
buffer
=
ByteBuffer
.
allocate
(
length
+
3
);
buffer
.
putShort
(
length
);
buffer
.
put
(
success
);
buffer
.
put
(
result
);
stream
.
write
(
buffer
.
array
());
stream
.
flush
();
...
...
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