func main() { SigHandler.Start(chAppStop) Logger.Start(1, 1, 1) Monitor.Start(Commen.GetConfig(Commen.WorkerMonitorAddr), NetConf.MONITOR_INTERNAL, chAppStop) //DBMgr.Start(Commen.GetConfig(Commen.MysqlAddr), 3, Commen.GetConfig(Commen.MongoAddr), 5, chAppStop) NetCore.StartTcpServer(Commen.GetConfig(Commen.WorkerAddr), chAppStop) //ServerJob.InitAgent(Commen.GetConfig(Commen.CourierAddr), NetConf.Worker, chAppStop) WaitStop() }
func main() { SigHandler.Start(chAppStop) Logger.Start(1, 1, 1) Monitor.Start(Commen.GetConfig(Commen.CourierMonitorAddr), NetConf.MONITOR_INTERNAL, chAppStop) NetCore.StartTcpServer(Commen.GetConfig(Commen.CourierAddr), chAppStop) InitHandlers() EventMgrExample() WaitStop() }
func main() { SigHandler.Start() Logger.Start(1, 1, 1) Monitor.Start(Commen.GetConfig(Commen.WorkerMonitorAddr), 5, chAppStop) ServerJob.InitHandlers() ClientJob.InitHandlers() DBMgr.Start(Commen.GetConfig(Commen.MysqlAddr), 3, Commen.GetConfig(Commen.MongoAddr), 5, chAppStop) NetCore.StartTcpServer(Commen.GetConfig(Commen.WorkerAddr), chAppStop) ServerJob.InitAgent(Commen.GetConfig(Commen.CourierAddr), NetConf.Worker, chAppStop) WaitStop() }
func start() { NetCore.AddMsgHandler(MsgConf.Regist, handleRegist) NetCore.AddMsgHandler(MsgConf.HeartBeat2, handleHeartBeat2) for i := 0; i < ROBOT_NUM; i++ { robots[i] = nil } for i := 0; i < ROBOT_NUM; i++ { NetCore.NewAgent(&robots[i], "127.0.0.1"+Commen.GetConfig(Commen.WorkerAddr), NetConf.Client, "") } }
func main() { SigHandler.Start(chAppStop) Logger.Start(1, 1, 1) Monitor.Start(Commen.GetConfig(Commen.AdminMonitorAddr), NetConf.MONITOR_INTERNAL, chAppStop) ServerJob.InitHandlers() ServerJob.InitAgent(Commen.GetConfig(Commen.CourierAddr), NetConf.Admin, chAppStop) port, err := strconv.Atoi(Commen.GetConfig(Commen.AdminPort)) if err != nil { Logger.Println("Server Stop, Get Config Port Error:", Commen.GetConfig(Commen.AdminPort), err) os.Exit(0) } HomePage.Start(port) WaitStop() }
func main() { connArr := make([]net.Conn, ROBOT_NUM) t1 := time.Now().Unix() for i := 0; i < ROBOT_NUM; i++ { conn, err := net.Dial("tcp", "127.0.0.1"+Commen.GetConfig(Commen.WorkerAddr)) connArr[i] = conn checkError(err) } t2 := time.Now().Unix() fmt.Println(t2 - t1) for i := 0; i < ROBOT_NUM; i++ { go robot(i, connArr[i]) } time.Sleep(time.Hour * 2400) }