Created
July 12, 2010 18:35
-
-
Save scottfrazer/472877 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
import java.io.*; | |
public class serve | |
{ | |
public static void main(String args[]) | |
{ | |
try | |
{ | |
ServerSocket server = new ServerSocket( 80 ); | |
Socket connection = server.accept(); | |
OutputStream out = connection.getOutputStream(); | |
out.write("HTTP/1.1 200 OK\r\n\r\n".getBytes()); | |
out.write("Hello World! My Web Server Works!".getBytes()); | |
out.flush(); | |
connection.close(); | |
} | |
catch (Exception e) | |
{ | |
System.err.println("Error: " + e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a test comment