Documentation ¶
Overview ¶
Package tcpsock provides easy to use interfaces for TCP I/O. It's designed especially for developing online games.
Index ¶
Constants ¶
View Source
const ( RecvBufLenMax = 16 * 1024 SendBufLenMax = 24 * 1024 TcpBufLenMax = 16 * 1024 )
View Source
const (
NumOfConnMax = 10000
)
View Source
const (
TcpDialTimeoutInSecs = 2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OnTcpClose ¶
type OnTcpClose = func() error
type OnTcpConnect ¶
type OnTcpConnect = func(conn *TcpConn) TcpSession
type OnTcpDisconnect ¶
type OnTcpDisconnect = func(conn *TcpConn)
type OnTcpError ¶
type OnTcpIterate ¶
type OnTcpIterate = func(id uint64, session TcpSession)
type OnTcpWrite ¶
type TcpClient ¶
type TcpClient struct { *TcpConn // contains filtered or unexported fields }
func NewTcpClient ¶
func NewTcpClient(svrAddr string, onConnect OnTcpConnect, onDisconnect OnTcpDisconnect) *TcpClient
type TcpServer ¶
type TcpServer struct {
// contains filtered or unexported fields
}
func NewTcpServer ¶
func NewTcpServer(addr string, onConnect OnTcpConnect, onDisconnect OnTcpDisconnect, onCheckIP OnCheckIP) *TcpServer
func (*TcpServer) GetSession ¶
func (self *TcpServer) GetSession(id uint64) TcpSession
func (*TcpServer) Iterate ¶
func (self *TcpServer) Iterate(fn OnTcpIterate)
Click to show internal directories.
Click to hide internal directories.