Пример #1
0
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
func (this *CallBack) CloseCome(c *ymtcp.Conn) {
	addr := c.GetConnRemoteAddr()
	log.Println("conntion close:", addr.String())
}
Пример #3
0
func (this *CallBack) ConnectCome(c *ymtcp.Conn) bool {
	addr := c.GetConnRemoteAddr()
	fmt.Println("connection come:", addr.String())
	return true
}