Versions in this module Expand all Collapse all v1 v1.0.1 Nov 6, 2019 Changes in this version + var KeepAlivePeriod time.Duration = 3000 + var MsgHeaderSize int = 2 + var TcpClientRecvChanSize int = 4 + var TcpClientSendChanSize int = 4 + var TcpServerRecvChanSize int = 4 + var TcpServerSendChanSize int = 4 + var UdpClientRecvChanSize int = 4 + var UdpClientSendChanSize int = 4 + var UdpPacketSize int = 10240 + var UdpServerRecvChanSize int = 1024 + var UdpServerSendChanSize int = 1024 + type IClient interface + Connect func(addr string) error + type IConn interface + Close func() error + LocalAddr func() string + RemoteAddr func() string + Send func([]byte) + SetDataParser func(IDataParser) + SetListener func(IConnListener) + type IConnListener interface + OnClose func() + OnError func(int, string) + OnPostSend func([]byte, int) + OnPreSend func([]byte) + OnRecvBusy func([]byte) + OnSendBusy func([]byte) + type IDataParser interface + Parse func(io.Reader) error + type IServer interface + Start func(addr string, connhandler func(net.Conn)) error + Stop func() error + type KcpServer struct + func NewKcpServer() *KcpServer + func (this *KcpServer) Start(addr string, connhandler func(net.Conn)) error + func (this *KcpServer) Stop() error + type Server struct + func NewServer() *Server + func (this *Server) Start(net, addr string, connhandler func(net.Conn)) error + func (this *Server) Stop() error + type ServerEx struct + func NewServerEx() *ServerEx + func (this *ServerEx) Start(net, ip string, startport, endport int, connhandler func(net.Conn)) error + func (this *ServerEx) Stop() error + type TcpServer struct + func NewTcpServer() *TcpServer + func (this *TcpServer) Start(addr string, connhandler func(net.Conn)) error + func (this *TcpServer) Stop() error + type UdpConn struct + func (this *UdpConn) Close() error + func (this *UdpConn) LocalAddr() net.Addr + func (this *UdpConn) Read(p []byte) (n int, err error) + func (this *UdpConn) RemoteAddr() net.Addr + func (this *UdpConn) Send(buff []byte) + func (this *UdpConn) SetDataParser(parser IDataParser) + func (this *UdpConn) SetDeadline(t time.Time) error + func (this *UdpConn) SetListener(listener IConnListener) + func (this *UdpConn) SetReadDeadline(t time.Time) error + func (this *UdpConn) SetWriteDeadline(t time.Time) error + func (this *UdpConn) Write(b []byte) (n int, err error) + type UdpServer struct + Addr string + Listener udpServerListener + func NewUdpServer(addr string) *UdpServer + func (this *UdpServer) Send(buff []byte, raddr *net.UDPAddr) + func (this *UdpServer) Start() error + func (this *UdpServer) Stop() error + type UdpServerEx struct + func NewUdpServerEx() *UdpServerEx + func (this *UdpServerEx) OnError(errcode int, msg string) + func (this *UdpServerEx) OnPostSend(buff []byte, raddr *net.UDPAddr, num int) + func (this *UdpServerEx) OnPreSend(buff []byte, raddr *net.UDPAddr) + func (this *UdpServerEx) OnRecv(buff []byte, raddr *net.UDPAddr) + func (this *UdpServerEx) OnRecvBusy(buff []byte, raddr *net.UDPAddr) + func (this *UdpServerEx) OnSendBusy(buff []byte, raddr *net.UDPAddr) + func (this *UdpServerEx) OnStop() + func (this *UdpServerEx) Start(addr string, connhandler func(net.Conn)) error + type WsServer struct + func NewWsServer() *WsServer + func (this *WsServer) Start(addr string, connhandler func(net.Conn)) error + func (this *WsServer) Stop() error v1.0.0-alpha Nov 6, 2019