示例#1
0
文件: server.go 项目: iamyh/ymtcp
func (this *CallBack) MessageCome(c *ymtcp.Conn, bytes []byte) error {
	addr := c.GetConnRemoteAddr()
	log.Printf("message come from:[%s] [%s]\n", addr.String(), string(bytes))
	buff, err := ymtcp.MakePacket(bytes)
	if err != nil {
		return err
	}

	c.WriteBytesToChan(buff)
	return nil
}
示例#2
0
文件: server.go 项目: iamyh/ymtcp
func (this *CallBack) CloseCome(c *ymtcp.Conn) {
	addr := c.GetConnRemoteAddr()
	log.Println("conntion close:", addr.String())
}
示例#3
0
文件: server.go 项目: iamyh/ymtcp
func (this *CallBack) ConnectCome(c *ymtcp.Conn) bool {
	addr := c.GetConnRemoteAddr()
	fmt.Println("connection come:", addr.String())
	return true
}