Skip to content

Instantly share code, notes, and snippets.

@draftcode
Created August 20, 2013 12:33
Show Gist options
  • Select an option

  • Save draftcode/6280780 to your computer and use it in GitHub Desktop.

Select an option

Save draftcode/6280780 to your computer and use it in GitHub Desktop.
package main
import (
"io"
"log"
"net"
)
func handleConnection(conn net.Conn) {
io.WriteString(conn, "HTTP/1.1 2000000000000000000000000000000000000000000000000000000000000000 OK\r\nConnection: close\r\nContent-Length: 5\r\n\r\nSuccess\r\n")
conn.Close()
}
func main() {
ln, err := net.Listen("tcp", ":8080")
if err != nil {
log.Fatal(err)
}
for {
conn, err := ln.Accept()
if err != nil {
continue
}
go handleConnection(conn)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment