Example #1
0
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")
}
Example #2
0
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")

}
Example #3
0
func (p *simplePeer) OnRecvPack(code int, pack []byte) {
	elog.LogInfo("onRecv:")
}
Example #4
0
func (self *ServerAppBase) onEnd() {
	elog.LogInfo("gameserver end...")
	elog.Flush()
}
Example #5
0
func (self *ServerAppBase) onStart() {
	elog.LogInfo("gameserver start...")
}