-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathServer.java
More file actions
49 lines (29 loc) · 737 Bytes
/
Server.java
File metadata and controls
49 lines (29 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*;
import java.net.*;
import java.io.*;
public class Server {
Date now = new Date();
public static void main(String[] args) {
try
{
ServerSocket serverSock = new ServerSocket(8675);
while (true)
{
Socket connectionSock = serverSock.accept();
// Construct an object to process the HTTP request message.
HTTPRequest request = new HTTPRequest( connectionSock );
// Create a new thread to process the request.
Thread thread = new Thread(request);
thread.start();
}
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
catch (Exception e)
{
System.out.println(e.getMessage());
}//End of main
}
}