aa
This commit is contained in:
22
main.go
22
main.go
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
@@ -139,6 +140,20 @@ func main() {
|
||||
go func() {
|
||||
if globals.IsMainProductEnv() {
|
||||
http.ListenAndServe("0.0.0.0:6061", nil)
|
||||
l, err := net.Listen("tcp", "http://print.jxcs.net:8000")
|
||||
if err != nil {
|
||||
fmt.Println("listen error:", err)
|
||||
return
|
||||
}
|
||||
for {
|
||||
c, err := l.Accept()
|
||||
if err != nil {
|
||||
fmt.Println("accept error:", err)
|
||||
break
|
||||
}
|
||||
globals.SugarLogger.Debugf("tcp socket:", utils.Format4Output(c, true))
|
||||
go handleConn(c)
|
||||
}
|
||||
} else {
|
||||
http.ListenAndServe("0.0.0.0:6060", nil)
|
||||
}
|
||||
@@ -146,3 +161,10 @@ func main() {
|
||||
beego.Run()
|
||||
}
|
||||
}
|
||||
|
||||
func handleConn(c net.Conn) {
|
||||
defer c.Close()
|
||||
for {
|
||||
globals.SugarLogger.Debugf("tcp socket read:", utils.Format4Output(c, true))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user