mirror of https://github.com/tidwall/tile38.git
23 lines
345 B
Go
23 lines
345 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:2003")
|
||
|
l, err := net.ListenTCP("tcp", addr)
|
||
|
if nil != err {
|
||
|
log.Fatalln(err)
|
||
|
}
|
||
|
log.Println("listening", l.Addr())
|
||
|
for {
|
||
|
c, err := l.AcceptTCP()
|
||
|
if nil != err {
|
||
|
log.Fatalln(err)
|
||
|
}
|
||
|
log.Println("accepted", c.RemoteAddr())
|
||
|
}
|
||
|
}
|