Documentation ¶
Index ¶
Constants ¶
View Source
const ( MAX_SELECTTIMES int = 10 CLOSESELF_CMD int16 = ^int16(0) - 1 CLOSESELF_MAGICVALUE uint32 = ^uint32(0) - 1016 CLOSESELF_MSGID uint32 = ^uint32(0) - 78117 CLOSESLEF_DATALEN int32 = int32(^uint32(0)>>1) - 120703 )
View Source
const (
DEF_TCPRECVBUF_SIZE int = 1 << 20
)
Variables ¶
This section is empty.
Functions ¶
func PoolPutSessionData ¶
func PoolPutSessionData(data *NetSessionData)
Types ¶
type NetSession ¶
type NetSession struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(sessionID uint32, conn *net.TCPConn, nt *NetTransport) *NetSession
func (NetSession) RemoteAddr ¶
func (ns NetSession) RemoteAddr() string
type NetSessionData ¶
type NetSessionData struct { Cmd SessionCmd SessionID uint32 MsgId uint32 // 消息序号 Data []byte }
func PoolGetSessionData ¶
func PoolGetSessionData() *NetSessionData
type NetTransport ¶
type NetTransport struct {
// contains filtered or unexported fields
}
func StartNetTransport ¶
func StartNetTransport(listenIP string, listenPort int, config *NetTransportConfig) (*NetTransport, error)
func (*NetTransport) CurrSessionCount ¶
func (nt *NetTransport) CurrSessionCount() int32
func (*NetTransport) ReadDataCh ¶
func (nt *NetTransport) ReadDataCh() <-chan *NetSessionData
func (*NetTransport) ShutDown ¶
func (nt *NetTransport) ShutDown()
func (*NetTransport) WriteData ¶
func (nt *NetTransport) WriteData(data *NetSessionData)
type NetTransportConfig ¶
type NetTransportConfig struct {
// contains filtered or unexported fields
}
func NewDefaultNetTransportConfig ¶
func NewDefaultNetTransportConfig() *NetTransportConfig
type SessionCmd ¶
type SessionCmd int
const ( E_SESSIONCMD_STARTCONN SessionCmd = iota // 握手通过,通知业务新连接到来 E_SESSIONCMD_STOPCONN // 客户端断开连接 E_SESSIONCMD_ACTIVESTOPCONN // 服务器主动断开连接 E_SESSIONCMD_TRANSFER // 数据透传 )
func (SessionCmd) String ¶
func (i SessionCmd) String() string
type SessionPeekState ¶
type SessionPeekState int
const ( E_SESSIONPEEKSTATE_HEAD SessionPeekState = iota E_SESSIONPEEKSTATE_WHOLE )
func (SessionPeekState) String ¶
func (i SessionPeekState) String() string
type SessionState ¶
type SessionState int
const ( E_SESSIONSTATE_VERIFIY_SYN SessionState = iota E_SESSIONSTATE_VERIFIY_ACK E_SESSIONSTATE_CONNECTED )
func (SessionState) String ¶
func (i SessionState) String() string
Click to show internal directories.
Click to hide internal directories.