Esempio n. 1
0
func (this *Callback) OnClose(c *gotcp.Conn) {
	log.Println("OnClose:", c.GetExtraData())

	addr := c.GetExtraData()
	this.cm.DelConn(addr)

}
Esempio n. 2
0
func (this *Callback) OnConnect(c *gotcp.Conn) bool {
	addr := c.GetRawConn().RemoteAddr()
	c.PutExtraData(addr.String())
	//str := addr.String()
	/* act on str */
	this.cm.AddConn(addr.String(), c)

	log.Println("OnConnect:", addr)
	return true
}