Skip to content

Instantly share code, notes, and snippets.

@scottfrazer
Created July 12, 2010 18:35
Show Gist options
  • Save scottfrazer/472877 to your computer and use it in GitHub Desktop.
Save scottfrazer/472877 to your computer and use it in GitHub Desktop.
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);
}
}
}
@scottfrazer
Copy link
Author

This is a test comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment