Skip to content

Instantly share code, notes, and snippets.

@wingyplus
Last active August 29, 2015 13:59
Show Gist options
  • Save wingyplus/10881496 to your computer and use it in GitHub Desktop.
Save wingyplus/10881496 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io/ioutil"
"net"
)
func main() {
listener, err := net.Listen("tcp", ":8000")
if err != nil {
panic(err.Error())
}
for {
conn, err := listener.Accept()
if err != nil {
fmt.Println(err.Error())
}
go func(c net.Conn) {
io.Copy(os.Stdout, c)
}(conn)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment