diff options
Diffstat (limited to 'web/attachments/49902-Http.java')
-rw-r--r-- | web/attachments/49902-Http.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/web/attachments/49902-Http.java b/web/attachments/49902-Http.java new file mode 100644 index 0000000..5f2c076 --- /dev/null +++ b/web/attachments/49902-Http.java | |||
@@ -0,0 +1,12 @@ | |||
1 | import java.net.*; | ||
2 | public class Http { | ||
3 | private static final String EOL = "\r\n"; | ||
4 | public static void main(String args[]) throws Exception { | ||
5 | ServerSocket server = new ServerSocket(8911); | ||
6 | while (true) { | ||
7 | Socket sock = server.accept(); | ||
8 | sock.getOutputStream().write(("HTTP/1.0 " + HttpURLConnection.HTTP_OK + EOL + "Content-type: text/html" + EOL + EOL + "Some example text").getBytes()); | ||
9 | sock.close(); | ||
10 | } | ||
11 | } | ||
12 | } \ No newline at end of file | ||