Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 29 lines (25 sloc) 0.331 kb
44bd5e1 INADA Naoki Add go implementation by tokuhirom
authored
1 package main
d1c475c INADA Naoki go: go fmt
authored
2
44bd5e1 INADA Naoki Add go implementation by tokuhirom
authored
3 import (
d1c475c INADA Naoki go: go fmt
authored
4 "io"
5 "log"
6 "net"
44bd5e1 INADA Naoki Add go implementation by tokuhirom
authored
7 )
8
6ef4bce INADA Naoki Supporg go 1
authored
9 func echo_handler(conn net.Conn) {
d1c475c INADA Naoki go: go fmt
authored
10 defer conn.Close()
11 io.Copy(conn, conn)
44bd5e1 INADA Naoki Add go implementation by tokuhirom
authored
12 }
13
14 func main() {
d1c475c INADA Naoki go: go fmt
authored
15 psock, e := net.Listen("tcp", ":5000")
16 if e != nil {
17 log.Fatal(e)
18 return
19 }
20 for {
21 conn, e := psock.Accept()
22 if e != nil {
23 log.Fatal(e)
24 return
25 }
26 go echo_handler(conn)
27 }
44bd5e1 INADA Naoki Add go implementation by tokuhirom
authored
28 }
Something went wrong with that request. Please try again.