socket

package
v0.0.0-...-9f872dd Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteBuffer

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

func NewByteBuffer

func NewByteBuffer() *ByteBuffer

func (*ByteBuffer) Append

func (b *ByteBuffer) Append(buff ...byte)

func (*ByteBuffer) MaxSize

func (b *ByteBuffer) MaxSize() int

func (*ByteBuffer) Prepend

func (b *ByteBuffer) Prepend(buff []byte) bool

func (*ByteBuffer) RdBuf

func (b *ByteBuffer) RdBuf() []byte

func (*ByteBuffer) RdFlip

func (b *ByteBuffer) RdFlip(size int)

func (*ByteBuffer) RdReady

func (b *ByteBuffer) RdReady() bool

func (*ByteBuffer) RdSize

func (b *ByteBuffer) RdSize() int

func (*ByteBuffer) Reset

func (b *ByteBuffer) Reset()

func (*ByteBuffer) WrBuf

func (b *ByteBuffer) WrBuf() []byte

func (*ByteBuffer) WrFlip

func (b *ByteBuffer) WrFlip(size int)

func (*ByteBuffer) WrGrow

func (b *ByteBuffer) WrGrow(size int)

func (*ByteBuffer) WrSize

func (b *ByteBuffer) WrSize() int

type Session

type Session struct {
	Conn *net.TCPConn

	HeartTime time.Time

	OnClose func() // 关闭函数回调
	// contains filtered or unexported fields
}

func NewSession

func NewSession(conn *net.TCPConn) *Session

func (*Session) Close

func (s *Session) Close() bool

func (*Session) GetID

func (s *Session) GetID() int64

func (*Session) GetTag

func (s *Session) GetTag() interface{}

func (*Session) IsClosed

func (s *Session) IsClosed() bool

func (*Session) RemoteAddr

func (s *Session) RemoteAddr() string

func (*Session) Reply

func (s *Session) Reply(header *fnet.Message, msg interface{}, status uint8) bool

func (*Session) Request

func (s *Session) Request(msg interface{}, status, serializeType uint8, indexId uint32) bool

func (*Session) SetID

func (s *Session) SetID(id int64)

func (*Session) SetTag

func (s *Session) SetTag(tag interface{})

func (*Session) Start

func (s *Session) Start()

type TcpClient

type TcpClient struct {
	Address       string
	Tag           string
	SerializeType fnet.SerializeType
	// contains filtered or unexported fields
}

func NewTcpClient

func NewTcpClient(tag, address string) *TcpClient

func (*TcpClient) AddCloseHandler

func (t *TcpClient) AddCloseHandler(f fnet.OnCloseFunc)

func (*TcpClient) AddConnectHandler

func (t *TcpClient) AddConnectHandler(f fnet.OnConnectFunc)

func (*TcpClient) GetID

func (t *TcpClient) GetID() int64

func (*TcpClient) IsRunning

func (t *TcpClient) IsRunning() bool

func (*TcpClient) Reply

func (t *TcpClient) Reply(header *fnet.Message, msg interface{}, status uint8) bool

func (*TcpClient) Run

func (t *TcpClient) Run()

func (*TcpClient) Send

func (t *TcpClient) Send(msg interface{}, status uint8) bool

func (*TcpClient) SetRunning

func (t *TcpClient) SetRunning(v bool)

func (*TcpClient) Stop

func (t *TcpClient) Stop()

type TcpServer

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

func NewDefaultTcpServer

func NewDefaultTcpServer(addr string) *TcpServer

func NewTcpServer

func NewTcpServer(addr string, maxcon int) *TcpServer

func (*TcpServer) AddCloseHandler

func (t *TcpServer) AddCloseHandler(f fnet.OnCloseFunc)

func (*TcpServer) AddConnectHandler

func (t *TcpServer) AddConnectHandler(f fnet.OnConnectFunc)

func (*TcpServer) Run

func (t *TcpServer) Run()

Run run with signal handle

func (*TcpServer) SetBeforeExit

func (t *TcpServer) SetBeforeExit(f func())

func (*TcpServer) SetReload

func (t *TcpServer) SetReload(f func())

func (*TcpServer) Start

func (t *TcpServer) Start()

func (*TcpServer) Stop

func (t *TcpServer) Stop()

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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