示例#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")
}
示例#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")

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