func (self *ServerAppBase) initialize() { elog.LogInfo("\nServer initializing...\n") // 开启多核 runtime.GOMAXPROCS(runtime.NumCPU()) elog.LogInfo("current CPUs: ", runtime.NumCPU(), "\n") // 开启控制台 go console.Console(self.Quit, self.cmds) elog.LogInfo("Server console activated.\n") }
func main() { elog.InitLog(elog.INFO) tcpServer, err := es.NewTcpServer() if err != nil { elog.LogInfo("crate tcp socket fail ") } ch := make(chan os.Signal) signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) fmt.Println(" begin listen....") tcpServer.Listen("0.0.0.0:6798") tcpServer.Run() fmt.Println(" begin listen....") fmt.Println(<-ch) tcpServer.Exit() elog.LogSys("Hhhhhh") }
func (p *simplePeer) OnRecvPack(code int, pack []byte) { elog.LogInfo("onRecv:") }
func (self *ServerAppBase) onEnd() { elog.LogInfo("gameserver end...") elog.Flush() }
func (self *ServerAppBase) onStart() { elog.LogInfo("gameserver start...") }