Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Group8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EC504 Spring 2024 Group Projects
Group8
Commits
5639964d
Commit
5639964d
authored
1 year ago
by
Rohan Kumar
Browse files
Options
Downloads
Patches
Plain Diff
"push"
parent
c7c03df6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
object_detection/ObjectDetectionServer.java
+47
-0
47 additions, 0 deletions
object_detection/ObjectDetectionServer.java
object_detection/ObjectDetector.java
+2
-1
2 additions, 1 deletion
object_detection/ObjectDetector.java
with
49 additions
and
1 deletion
object_detection/ObjectDetectionServer.java
0 → 100644
+
47
−
0
View file @
5639964d
package
object_detection
;
import
java.net.ServerSocket
;
import
java.net.Socket
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.FileWriter
;
// file writing support
import
java.nio.charset.StandardCharsets
;
public
class
ObjectDetectionServer
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
final
ServerSocket
server
=
new
ServerSocket
(
80
);
// port 80
System
.
out
.
println
(
"Listening for connection on port 80..."
);
while
(
true
)
{
try
(
Socket
clientSocket
=
server
.
accept
();
FileWriter
fw
=
new
FileWriter
(
"blank.txt"
,
true
);
// open file in append mode
)
{
InputStreamReader
isr
=
new
InputStreamReader
(
clientSocket
.
getInputStream
());
BufferedReader
reader
=
new
BufferedReader
(
isr
);
String
line
=
reader
.
readLine
();
while
(!
line
.
isEmpty
())
{
System
.
out
.
println
(
line
);
fw
.
write
(
line
+
"\n"
);
// write line to file
line
=
reader
.
readLine
();
}
fw
.
flush
();
// ensure all data is written to file
// at this point, run ObjectDetector
ObjectDetector
.
run
(
fw
.
toString
());
// HTTP response
String
httpResponse
=
"HTTP/1.1 200 OK\r\n\r\n"
+
"<html><body><h1>Hello, World!</h1></body></html>"
;
// dispatching HTTP response to the client
OutputStream
outputStream
=
clientSocket
.
getOutputStream
();
outputStream
.
write
(
httpResponse
.
getBytes
(
StandardCharsets
.
UTF_8
));
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
// handle exceptions appropriately
}
}
}
}
This diff is collapsed.
Click to expand it.
object_detection/ObjectDetector.java
+
2
−
1
View file @
5639964d
package
object_detection
;
public
class
ObjectDetector
{
static
ObjectSet
os
;
public
static
void
mai
n
(
String
[]
args
){
public
static
void
ru
n
(
String
pathname
){
/* infinite loop of running system:
1) Get new info from system
...
...
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