network

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

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

Go to latest
Published: Oct 24, 2021 License: GPL-3.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

View Source
const (
	UNKNOWN      int32 = 0
	INITED       int32 = 1
	CONNECTED    int32 = 2
	WRITE_CLOSED int32 = 3
	READ_CLOSED  int32 = 4
	DESTROYED    int32 = 5
)

connection int32us

Variables

View Source
var HandShakeTimeout time.Duration = time.Duration(3000) * time.Millisecond
View Source
var HeaderBytes int = 1024
View Source
var PackSize int = 1400 // package size(default:MTU)
View Source
var ReadBufSize int = 64 * PackSize // total read buf size
View Source
var ReadTimeout time.Duration = time.Duration(3000) * time.Millisecond
View Source
var WriteBufSize int = 64 * PackSize // totaol write buf size
View Source
var WriteTimeout time.Duration = time.Duration(3000) * time.Millisecond

Functions

This section is empty.

Types

type ClientI

type ClientI interface {
	Dial(addr string) (SessionI, error)
}

type ConnCloseCB

type ConnCloseCB func(SessionI)

type NewConnCB

type NewConnCB func(SessionI)

type OnMsgCB

type OnMsgCB func(SessionI, []byte)

type ServerI

type ServerI interface {
	Listen(addr string) error
	Close()
}

type SessionI

type SessionI interface {
	Run() error
	Read(arg []byte) (int, error)
	Write(args ...[]byte) (int, error)
	Close()
	Destroy()
}

type TcpClient

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

func NewTcpClient

func NewTcpClient() *TcpClient

func (*TcpClient) Dial

func (cli *TcpClient) Dial(addr string, opts ...interface{}) (*TcpConn, error)

type TcpConn

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

func NewTcpConn

func NewTcpConn(conn net.Conn, opts ...interface{}) (*TcpConn, error)

func (*TcpConn) Close

func (c *TcpConn) Close()

func (*TcpConn) Destroy

func (c *TcpConn) Destroy()

func (*TcpConn) Read

func (c *TcpConn) Read(arg []byte) (int, error)

func (*TcpConn) Run

func (c *TcpConn) Run() error

func (*TcpConn) Write

func (c *TcpConn) Write(args ...[]byte) (int, error)

type TcpServer

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

func NewTcpServer

func NewTcpServer() *TcpServer

func (*TcpServer) Close

func (s *TcpServer) Close()

func (*TcpServer) Listen

func (s *TcpServer) Listen(addr string, opts ...interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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