Documentation
¶
Index ¶
- type NetEngine
- func (c *NetEngine) AddConnection(con net.Conn, notify NetNotify, recvBufLen, maxSendBufLen int, ...) (id int, err error)
- func (c *NetEngine) AddListen(lis net.Listener, notify NetNotify) (id int, err error)
- func (c *NetEngine) Close(id int)
- func (c *NetEngine) GetLocalAddr(id int) (net.Addr, bool)
- func (c *NetEngine) GetRemoteAddr(id int) (net.Addr, bool)
- func (c *NetEngine) GetSendFunc(id int) SendFunc
- func (c *NetEngine) Init() error
- func (c *NetEngine) Send(id int, data []byte)
- func (c *NetEngine) Start(id int)
- func (c *NetEngine) Stop()
- type NetNotify
- type SendFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetEngine ¶
type NetEngine struct {
// contains filtered or unexported fields
}
func (*NetEngine) AddConnection ¶
func (*NetEngine) GetSendFunc ¶
SendFunc is synchronous
type NetNotify ¶
type NetNotify interface { /* 同一个listenid 会在一个goroute中调用, 新的连接需要手动, id,err := AddConnection Start(id) */ OnAccepted(listenid int, con net.Conn) /* return -1 to close return >0 to consume data return 0 need more data use send to send data get more performance data is valid only in OnRecv, so careful to use it */ OnRecv(id int, data []byte, send SendFunc) int // OnClosed,OnBufferLimit,OnAccept不会在同一个goroute中调用 OnClosed(id int) // write buffer limit, OnClosed always will call OnBufferLimit(id int) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.