Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Project1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
강임주
Project1
Commits
ad32ce36
Commit
ad32ce36
authored
Nov 02, 2020
by
강임주
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
d03e51da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
WebServer_blank.java
WebServer_blank.java
+37
-0
No files found.
WebServer_blank.java
0 → 100644
View file @
ad32ce36
import
java.io.*
;
import
java.net.*
;
import
java.util.*
;
public
final
class
WebServer_Blank
{
public
static
void
main
(
String
argv
[])
throws
Exception
{
try
{
// Could get the port number from the command line.
// int port = (new Integer(argv[0])).intValue();
// Establish the listen socket.
ServerSocket
serversocket
=
new
ServerSocket
(
8080
);
// Mission 1
// Process HTTP service requests in an infinite loop.
while
(
true
)
{
// Listen for a TCP connection request.
Socket
socket
=
serversocket
.
accept
();
// Mission 1
// Construct an object to process the HTTP request message.
HttpRequest_upgrade_blank
request
=
new
HttpRequest_upgrade_blank
(
socket
);
// Create a new thread to process the request.
Thread
thread
=
new
Thread
(
request
);
// mission 2
// Start the thread.
thread
.
start
();
}
}
catch
(
IOException
e
)
{
System
.
out
.
print
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
System
.
out
.
print
(
e
.
getMessage
());
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
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