gtclient

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MsgHeaderSize int = 2
View Source
var TcpClientRecvChanSize int = 4
View Source
var TcpClientSendChanSize int = 4
View Source
var TcpServerRecvChanSize int = 4
View Source
var TcpServerSendChanSize int = 4
View Source
var UdpClientRecvChanSize int = 4
View Source
var UdpClientSendChanSize int = 4
View Source
var UdpPacketSize int = 10240
View Source
var UdpServerRecvChanSize int = 1024
View Source
var UdpServerSendChanSize int = 1024

Functions

This section is empty.

Types

type Client

type Client struct {
	Session    *session.Session
	Conn       net.Conn
	UserEntity msg.IEntity
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c *Config) *Client

func (*Client) Close

func (this *Client) Close()

func (*Client) Connect

func (this *Client) Connect() error

func (*Client) Run

func (this *Client) Run()

type Config

type Config struct {
	SrvPeerId   uint64 `json:"srvpeerid"`
	SrvPeerType byte   `json:"srvpeertype"`
	UserEtype   uint16 `json:"useretype"`
	UserEid     uint64 `json:"usereid"`

	LocalPeerId   uint64 `json:"localpeerid`
	LocalPeerType byte   `json:"localpeertype"`

	Net     string `json:"net"`
	SrvAddr string `json:"srvaddr"`
}

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func (*Conn) Close

func (this *Conn) Close() error

func (*Conn) LocalAddr

func (this *Conn) LocalAddr() string

func (*Conn) RemoteAddr

func (this *Conn) RemoteAddr() string

func (*Conn) Send

func (this *Conn) Send(buff []byte)

func (*Conn) SetDataParser

func (this *Conn) SetDataParser(parser IDataParser)

func (*Conn) SetListener

func (this *Conn) SetListener(listener IConnListener)

type IClient

type IClient interface {
	Close()
	Connect(addr string) error
}

type IConn

type IConn interface {
	Send([]byte)
	Close() error
	LocalAddr() string
	RemoteAddr() string
	SetDataParser(IDataParser)
	SetListener(IConnListener)
}

type IConnListener

type IConnListener interface {
	OnClose()
	OnError(int, string)
	OnPreSend([]byte)
	OnPostSend([]byte, int)
	OnRecvBusy([]byte)
	OnSendBusy([]byte)
}

type IDataParser

type IDataParser interface {
	Parse(io.Reader) error
}

type IServer

type IServer interface {
	Start(addr string, connhandler func(net.Conn)) error
	Stop() error
}

type KcpClient

type KcpClient struct {
	Session *session.Session
}

func NewKcpClient

func NewKcpClient() *KcpClient

func (*KcpClient) Close

func (this *KcpClient) Close()

func (*KcpClient) Connect

func (this *KcpClient) Connect(addr string) error

type TcpClient

type TcpClient struct {
	Session *session.Session
}

func NewTcpClient

func NewTcpClient() *TcpClient

func (*TcpClient) Close

func (this *TcpClient) Close()

func (*TcpClient) Connect

func (this *TcpClient) Connect(addr string) error

type UdpClient

type UdpClient struct {
	// contains filtered or unexported fields
}

func NewUdpClient

func NewUdpClient() *UdpClient

func (*UdpClient) Close

func (this *UdpClient) Close()

func (*UdpClient) Connect

func (this *UdpClient) Connect(addr string) error

func (*UdpClient) LocalAddr

func (this *UdpClient) LocalAddr() string

func (*UdpClient) Read

func (this *UdpClient) Read(p []byte) (n int, err error)

func (*UdpClient) RemoteAddr

func (this *UdpClient) RemoteAddr() string

func (*UdpClient) Send

func (this *UdpClient) Send(buff []byte)

func (*UdpClient) SetDataParser

func (this *UdpClient) SetDataParser(parser IDataParser)

func (*UdpClient) SetListener

func (this *UdpClient) SetListener(listener IConnListener)

type WsClient

type WsClient struct {
	Session *session.Session
}

func NewWsClient

func NewWsClient() *WsClient

func (*WsClient) Close

func (this *WsClient) Close()

func (*WsClient) Connect

func (this *WsClient) Connect(addr string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL