本文整理匯總了Golang中github.com/giskook/gotcp.Conn.PutExtraData方法的典型用法代碼示例。如果您正苦於以下問題:Golang Conn.PutExtraData方法的具體用法?Golang Conn.PutExtraData怎麽用?Golang Conn.PutExtraData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/giskook/gotcp.Conn
的用法示例。
在下文中一共展示了Conn.PutExtraData方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: OnConnect
func (this *TelnetCallback) OnConnect(c *gotcp.Conn) bool {
addr := c.GetRawConn().RemoteAddr()
c.PutExtraData(addr)
fmt.Println("OnConnect:", addr)
c.AsyncWritePacket(NewTelnetPacket("unknow", []byte("Welcome to this Telnet Server")), 0)
return true
}
示例2: OnConnect
func (this *Callback) OnConnect(c *gotcp.Conn) bool {
conn := NewConn(c)
c.PutExtraData(conn)
return true
}
示例3: OnConnect
func (this *DasCallback) OnConnect(c *gotcp.Conn) bool {
addr := c.GetRawConn().RemoteAddr()
c.PutExtraData(addr)
fmt.Println("OnConnect:", addr)
return true
}
示例4: OnConnect
func (this *Callback) OnConnect(c *gotcp.Conn) bool {
heartbeat := GetConfiguration().GetServerConnCheckInterval()
readlimit := GetConfiguration().GetServerReadLimit()
writelimit := GetConfiguration().GetServerWriteLimit()
config := &ConnConfig{
HeartBeat: uint8(heartbeat),
ReadLimit: int64(readlimit),
WriteLimit: int64(writelimit),
}
conn := NewConn(c, config)
c.PutExtraData(conn)
//NewConns().Add(conn)
conn.Do()
return true
}
示例5: OnConnect
func (this *Callback) OnConnect(c *gotcp.Conn) bool {
checkinterval := GetConfiguration().GetServerConnCheckInterval()
readlimit := GetConfiguration().GetServerReadLimit()
writelimit := GetConfiguration().GetServerWriteLimit()
config := &ConnConfig{
ConnCheckInterval: uint16(checkinterval),
ReadLimit: uint16(readlimit),
WriteLimit: uint16(writelimit),
}
conn := NewConn(c, config)
c.PutExtraData(conn)
conn.Do()
NewConns().Add(conn)
return true
}