tcp

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenTCP

func ListenTCP(address string) (*net.TCPListener, error)

监听TCP端口

Types

type TCPClient

type TCPClient struct {
	Conn *network.Conn
	// contains filtered or unexported fields
}

TCP 客户端

func NewClient

func NewClient(plan *network.DialPlan, opts network.TCPOptions) *TCPClient

创建TCP客户端

func (*TCPClient) Close

func (c *TCPClient) Close() error

func (*TCPClient) Dialing

func (c *TCPClient) Dialing() (*network.Conn, error)

func (*TCPClient) GetConn

func (c *TCPClient) GetConn() *network.Conn

func (*TCPClient) GetPlan

func (c *TCPClient) GetPlan() *network.DialPlan

func (*TCPClient) SetConn

func (c *TCPClient) SetConn(conn *network.Conn)

type TCPServer

type TCPServer struct {
	*network.Server
	// contains filtered or unexported fields
}

TCP服务器

func NewServer

func NewServer(server *network.Server) *TCPServer

创建TCP服务器

func (*TCPServer) Run

func (s *TCPServer) Run(events network.Events) (err error)

开始服务,接受客户端连接,并进行读写

func (*TCPServer) Shutdown

func (s *TCPServer) Shutdown(events network.Events) (err error)

服务停止阶段,关闭每一个网络连接

func (*TCPServer) Startup

func (s *TCPServer) Startup(events network.Events) (err error)

服务启动阶段,执行Tick事件

Jump to

Keyboard shortcuts

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