Esempio n. 1
0
func main() {
	log.Println("client started ...")
	helper := imservice.NewHelper()
	helper.Connect("localhost", "8000")

	helper.RunCommand("login momo 123445")
	for {
		message := helper.PickMessage()
		if message == nil {
			break
		} else {
			log.Printf("%v", message)
		}
	}
	helper.RunCommand("logout momo")

	defer helper.Close()
}
Esempio n. 2
0
func main() {
	log.Println("client started ...")
	var err error
	helper := imservice.NewHelper()
	err = helper.Connect("localhost", "8000")
	if err != nil {
		log.Println("fail to connect server: ", err)
		return
	}

	for i := 0; i < len(commands); i++ {
		if err = helper.RunCommand(commands[i]); err != nil {
			log.Printf("Fail to run command:%s[%s]", commands[i], err)
			break
		}
	}

	defer helper.Close()
	if err == nil {
		log.Printf("all command success")
	}
}